level.pas
Petr "Zweistein" Prokop
{ zwei.stein@worldonline.cz, zweistein.kgb.cz }
Program BLevels;
{
(c) Petr "Zweistein" Prokop
Program Levels :
Malě experience gener tor pro mou hru Fate of Hero
}
Uses Dos;
Type LevArr = array [1..255] of longint;
Var I : Byte;
L : LevArr;
K : Real;
Base : LongInt;
FLev,TLev : Byte;
Y,Mo,D,x,H,M,S,SS:word;
Race,class,spe,comm,name,filename:String;
F : text;
FF: file;
Begin;
Writeln;
writeln('Enter data :');
write('Race (""=>Unknown)>');
readln(race);
if race='' then race:='Unknown';
Write('Class (""=>Unknown)>');
readln(class);
if class='' then class:='Unknown';
write('Special variant (""=>None)>');
readln(spe);
if spe='' then spe:='None';
write ('Note on numerics - program has limited capacity (for Base=500, K=1.1 is it maximum of 137 levels,');
Writeln('progam cant use higer experienxe than ',maxlongint,')');
write ('Base (0=>500)>');
readln (Base);
if base=0 then base:=500;
Write ('K (0=>1.1)>');
readln(K);
if k=0 then k:=1.1;
write ('From level (0=>1)>');
readln (flev);
if (flev>255) or (flev=0) then flev:=1;
write ('To level (O=>255)>');
readln(tlev);
if tlev=0 then tlev:=255;
if flev>tlev then
begin;
i:=tlev;
tlev:=flev;
flev:=i;
end;
write ('Your name (""=>Mr.X)>');
readln (Name);
if name='' then name:='Mr.X';
write ('Comment (""=>None)>');
readln (comm);
if comm='' then comm:='None';
write ('Filename (""=>fohlevel.tbl)>');
readln (filename);
if filename='' then filename:='fohlevel.tbl';
L[1]:=0;
L[2]:=Base;
Write ('Creating table');
For I:=3 To Tlev Do
Begin;
L[I]:=L[I-1]+Round(K*(L[I-1]-L[I-2]));
write('.');
End;
Writeln('Ok');
Write('Openig File');
assign(F,filename);
rewrite(F);
WriteLn(' Ok');
Write('Getting time and date');
GetTime(h,m,s,ss);
GetDate(y,mo,d,x);
writeln(' Ok');
write('Writing to file fasic info');
Writeln(f,'Level and Experience table file ',filename,' for Fate of Hero');
Writeln(f,'Made on ',y,'/',d,'/',mo,' ',h,':',m,':',s,' by ',name);
writeln(f,'For race ',race,' and class ',class,', special ',spe);
writeln(f,'Comment:',comm);
Writeln(f,'Base=',base,' K=',k:1:3,', From level ',flev,' to level ',tlev);
writeln(f,'Using Level(X) = Level(X-1) + K * ( Level(X-1) - Level(X-2) )');
writeln(' Ok');
write('Writing table');
writeln(f,'+---+----------+');
writeln(f,'|Lev|Experience|');
writeln(f,'+---+----------+');
For I:=Flev To Tlev Do
Begin;
Writeln(f,'|',i:3,'|',l[i]:10,'|');
write('.');
End;
writeln(f,'+---+----------+');
write(f,'[EOF ',filename,' ]');
writeln(' Ok');
close(f);
assign(ff,filename);
Reset(ff);
WriteLn(FileSize(ff),' bytes writen');
Close(ff);
Writeln('All OK');
end.