Item Creation in D1
#16
the Langolier,May 26 2005, 07:40 PM Wrote:Rarity App

I wrote this a little while ago based on Jarulf's guide.  Any item it won't calculate can't drop from monsters.  It has slightly different results than Jarulf's version, probably due to a slightly different monster distribution we each used. 

I also included results for racks (because on some items like Awesome plates it influenced the overall odds significantly) assuming an average appearance of 1 rack per type per game.  Since there are 14 levels a rack can appear on it becomes 1/14 chance for a rack per game per level.

If you have any questions about the statistics used by the calculator I will be happy to go into detail.
[right][snapback]78654[/snapback][/right]


OK, Below is my total monster count and it seems I used 185 monster on a level (normal monsters), except on level 1, 2 and 15 were I use 180 (more bosses though typically, it is for multplayer by the way) and level 16 were I use 187. I also include the code for bosses and such (soon I have pasted the whole program here :) ).

Code:
procedure domonsters(dlvl:word; var xprob:real);
var
 tprob : real;
 mslot : word;
begin
 tprob:=0;
 for mslot:=0 to mlast do begin
   if (mprob[mslot,dlvl]>0) and (not (mslot in [38..41,117])) then begin
     tprob:=tprob+onemprob(dlvl,mslot)*mprob[mslot,dlvl]/mprob[totmprobpos,dlvl];
   end;
 end;
 case dlvl of
    1 : xprob:=xprob*pot(1-tprob,170);
    2 : xprob:=xprob*pot(1-tprob,180);
   15 : xprob:=xprob*pot(1-tprob,180);
   16 : xprob:=xprob*pot(1-tprob,187);
 else
   xprob:=xprob*pot(1-tprob,185);
 end;
end;  { domonsters }


procedure dobosses(dlvl:word; var xprob:real);
var
 bslot     : word;
 blustslot : word;
begin
 if dgame then
   blustslot:=92
 else
   blustslot:=93;
 for bslot:=(lastspboss+1) to blast do begin
   if (dlvl=bdata^[bslot,12]) and (mprob[bdata^[bslot,0],dlvl]>0) then begin
     if bslot=blustslot then  { Bloodlust }
       xprob:=xprob*(1-onebprob(dlvl,bslot))
     else
       xprob:=xprob*(1-onebprob(dlvl,bslot)*mprob[bdata^[bslot,0],dlvl]/100)
   end;
 end;
end;  { dobosses }

I also include the following to make it more complete:

Code:
procedure dolazroom(var xprob:real);
begin
 xprob:=xprob*pot(1-onemprob(15,103),2);  { Hell Spawn    }
 xprob:=xprob*pot(1-onemprob(15,108),4);  { Advocate      }
 xprob:=xprob*(1-onebprob(15,4));         { Lazarus       }
 xprob:=xprob*(1-onebprob(15,5));         { Red Vex       }
 xprob:=xprob*(1-onebprob(15,6));         { Black Jade    }
end;  { dolazroom }


procedure docompletedungeon(var xprob:real; var hdlvl:word);
var
 dlvl,tdlvl  : word;
 tprob,hprob : real;
begin
 hprob:=1;
 tdlvl:=0;
 for dlvl:=1 to lastlevel do begin
   tprob:=xprob;
   domonsters(dlvl,xprob);
   dobosses(dlvl,xprob);
   doother(dlvl,xprob);
   case dlvl of
      2 : xprob:=xprob*(1-onebprob(2,9));          { Butcher       }
      3 : xprob:=xprob*(1-onebprob(3,1));          { Skeleton King }
     15 : dolazroom(xprob);
     16 : begin
            xprob:=xprob*(1-onemprob(16,110));     { Diablo        }
            xprob:=xprob*(1-onemprob(16,93));      { Black Knight  }
          end;
     19 : if islot in [154,155] then
            xprob:=xprob*(1-onebprob(19,10));      { Hork Demon    }

     { ej helt korrekt }

     24 : if islot in [124,143,145,150]  then
            xprob:=xprob*(1-onebprob(24,12));      { Na Krul       }
   end;
&nbsp; &nbsp;if (xprob/tprob)<hprob then begin
&nbsp; &nbsp; &nbsp;hprob:=xprob/tprob;
&nbsp; &nbsp; &nbsp;tdlvl:=dlvl;
&nbsp; &nbsp;end;
&nbsp;end;
&nbsp;hdlvl:=tdlvl;
end; &nbsp;{ docompletedungeon }


procedure docompletemonsters(var xprob:real; var hdlvl:word);
var
&nbsp;dlvl,tdlvl &nbsp;: word;
&nbsp;tprob,hprob : real;
begin
&nbsp;hprob:=1;
&nbsp;tdlvl:=0;
&nbsp;for dlvl:=1 to lastlevel do begin
&nbsp; &nbsp;tprob:=xprob;
&nbsp; &nbsp;domonsters(dlvl,xprob);
&nbsp; &nbsp;case dlvl of
&nbsp; &nbsp; &nbsp;15 : begin
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xprob:=xprob*pot(1-onemprob(15,103),2); &nbsp;{ Hell Spawn &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xprob:=xprob*pot(1-onemprob(15,108),4); &nbsp;{ Advocate &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;
&nbsp; &nbsp; &nbsp;16 : xprob:=xprob*(1-onemprob(16,93)); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ Black Knight &nbsp;}
&nbsp; &nbsp;end;
&nbsp; &nbsp;if (xprob/tprob)<hprob then begin
&nbsp; &nbsp; &nbsp;hprob:=xprob/tprob;
&nbsp; &nbsp; &nbsp;tdlvl:=dlvl;
&nbsp; &nbsp;end;
&nbsp;end;
&nbsp;hdlvl:=tdlvl;
end; &nbsp;{ docompletemonsters }


procedure docompletebosses(var xprob:real; var hdlvl:word);
var
&nbsp;dlvl,tdlvl &nbsp;: word;
&nbsp;tprob,hprob : real;
begin
&nbsp;hprob:=1;
&nbsp;tdlvl:=0;
&nbsp;for dlvl:=1 to lastlevel do begin
&nbsp; &nbsp;tprob:=xprob;
&nbsp; &nbsp;dobosses(dlvl,xprob);
&nbsp; &nbsp;case dlvl of
&nbsp; &nbsp; &nbsp; 2 : xprob:=xprob*(1-onebprob(2,9)); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ Butcher &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; 3 : xprob:=xprob*(1-onebprob(3,1)); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ Skeleton King }
&nbsp; &nbsp; &nbsp;15 : begin
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xprob:=xprob*(1-onebprob(15,4)); &nbsp; &nbsp; &nbsp; { Lazarus &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xprob:=xprob*(1-onebprob(15,5)); &nbsp; &nbsp; &nbsp; { Red Vex &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xprob:=xprob*(1-onebprob(15,6)); &nbsp; &nbsp; &nbsp; { Black Jade &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;
&nbsp; &nbsp; 16 : xprob:=xprob*(1-onemprob(16,110)); &nbsp; &nbsp; &nbsp; { Diablo &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp;end;
&nbsp; &nbsp;if (xprob/tprob)<hprob then begin
&nbsp; &nbsp; &nbsp;hprob:=xprob/tprob;
&nbsp; &nbsp; &nbsp;tdlvl:=dlvl;
&nbsp; &nbsp;end;
&nbsp;end;
&nbsp;hdlvl:=tdlvl;
end; &nbsp;{ docompletebosses }


procedure dolazrun(var xprob:real; var hdlvl:word);
var
&nbsp;dlvl,tdlvl &nbsp;: word;
&nbsp;tprob,hprob : real;
begin
&nbsp;hprob:=1;
&nbsp;tdlvl:=0;
&nbsp;for dlvl:=13 to 15 do begin
&nbsp; &nbsp;tprob:=xprob;
&nbsp; &nbsp;dobosses(dlvl,xprob);
&nbsp; &nbsp;case dlvl of
&nbsp; &nbsp; &nbsp;15 : &nbsp; dolazroom(xprob);
&nbsp; &nbsp;end;
&nbsp; &nbsp;if (xprob/tprob)<hprob then begin
&nbsp; &nbsp; &nbsp;hprob:=xprob/tprob;
&nbsp; &nbsp; &nbsp;tdlvl:=dlvl;
&nbsp; &nbsp;end;
&nbsp;end;
&nbsp;hdlvl:=tdlvl;
end; &nbsp;{ dolazrun }


procedure docustom(var xprob:real; var hdlvl:word);
var
&nbsp;dlvl : word;
begin
&nbsp;xprob:=xprob*(1-onebprob(15,4)); &nbsp; &nbsp; &nbsp; &nbsp; { Lazarus &nbsp; &nbsp; &nbsp; }
&nbsp;xprob:=xprob*(1-onebprob(15,5)); &nbsp; &nbsp; &nbsp; &nbsp; { Red Vex &nbsp; &nbsp; &nbsp; }
&nbsp;xprob:=xprob*(1-onebprob(15,6)); &nbsp; &nbsp; &nbsp; &nbsp; { Black Jade &nbsp; &nbsp;}
end; &nbsp;{ docustom }

The above is different routines for me to be able to calculate different "runs", like a typical Laz run, or full dungeon (game) or just some other specific case.

Below is the main function doing the calls. The "fixfile" is a file with list of specific magic items to do the calculations for, it lists prefix, suffix and base items. The mprob file is just a data file holding the same data for monster probability found in my guide for each level. I believe it is the output of the program that calculated those values which I then inserted into my Guide.

Code:
procedure domagicprob;
var
&nbsp;xprob &nbsp; &nbsp; &nbsp; : real;
&nbsp;many &nbsp; &nbsp; &nbsp; &nbsp;: boolean;
&nbsp;i,j &nbsp; &nbsp; &nbsp; &nbsp; : word;
&nbsp;fslot &nbsp; &nbsp; &nbsp; : word;
&nbsp;istart,iend : word;
&nbsp;hdlvl &nbsp; &nbsp; &nbsp; : word;
&nbsp;ok &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: boolean;
begin
&nbsp;readmprob(getpath+'mprob.txt');
&nbsp;readfixdata(getpath+'fixfile.txt');
&nbsp;writeheader;

{$IFDEF allrun}
&nbsp;for pslot:=0 to plast do begin
&nbsp; &nbsp;for sslot:=0 to slast do begin
&nbsp; &nbsp; &nbsp;islot:=255;
&nbsp; &nbsp; &nbsp;ok:=true;
{$ELSE}
&nbsp;if flast>0 then begin
&nbsp; &nbsp;for fslot:=1 to flast do begin
&nbsp; &nbsp; &nbsp;pslot:=fdata[fslot].pslot;
&nbsp; &nbsp; &nbsp;sslot:=fdata[fslot].sslot;
&nbsp; &nbsp; &nbsp;islot:=fdata[fslot].islot;
&nbsp; &nbsp; &nbsp;if not dgame then begin
&nbsp; &nbsp; &nbsp; &nbsp;case islot of
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;83..87 &nbsp;: islot:=islot+4;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;88..255 : islot:=islot+5;
&nbsp; &nbsp; &nbsp; &nbsp;end;
&nbsp; &nbsp; &nbsp;end;
&nbsp; &nbsp; &nbsp;if (pslot>plast) or (sslot>slast) or (islot>ilast) then
&nbsp; &nbsp; &nbsp; &nbsp;ok:=false
&nbsp; &nbsp; &nbsp;else
&nbsp; &nbsp; &nbsp; &nbsp;ok:=true;
{$ENDIF}
&nbsp; &nbsp; &nbsp;qlvlp:=pdata^[pslot,16];
&nbsp; &nbsp; &nbsp;qlvls:=sdata^[sslot,16];

&nbsp; &nbsp; &nbsp;write(target,qlvlp:4);
&nbsp; &nbsp; &nbsp;writename(target,pname^[pslot],1,1);
&nbsp; &nbsp; &nbsp;write(target,qlvls:3);
&nbsp; &nbsp; &nbsp;writename(target,sname^[sslot],1,1);

&nbsp; &nbsp; &nbsp;if dgame then
&nbsp; &nbsp; &nbsp; &nbsp;case islot of
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;152..153 : islot:=151;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;155 &nbsp; &nbsp; &nbsp;: islot:=154;
&nbsp; &nbsp; &nbsp; &nbsp;end
&nbsp; &nbsp; &nbsp;else
&nbsp; &nbsp; &nbsp; &nbsp;case islot of
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;157..158 : islot:=156;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;160 &nbsp; &nbsp; &nbsp;: islot:=159;
&nbsp; &nbsp; &nbsp; &nbsp;end;

&nbsp; &nbsp; &nbsp;if islot=255 then begin
&nbsp; &nbsp; &nbsp; &nbsp;istart:=startbitem;
&nbsp; &nbsp; &nbsp; &nbsp;iend:=ilast; end
&nbsp; &nbsp; &nbsp;else begin
&nbsp; &nbsp; &nbsp; &nbsp;istart:=islot;
&nbsp; &nbsp; &nbsp; &nbsp;iend:=istart;
&nbsp; &nbsp; &nbsp;end;

&nbsp; &nbsp; &nbsp;many:=false;
&nbsp; &nbsp; &nbsp;for islot:=istart to iend do begin
&nbsp; &nbsp; &nbsp; &nbsp;if prefixpossible(islot,pslot) and suffixpossible(islot,sslot) and ok then begin
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if many then
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;write(target,'':61);

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;qlvli:=idata^[islot,24];
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;write(target,qlvli:2);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;writename(target,iname1^[islot],1,1);

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;writeln(pname^[pslot]:25,sname^[sslot]:25,iname1^[islot]:25);

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;many:=true;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for run:=0 to lastrun do begin
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if runs[run]=1 then begin
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for diff:=0 to 2 do begin
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xprob:=1;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;case run of
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 : docustom(xprob,hdlvl);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 : docompletedungeon(xprob,hdlvl);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2 : docompletemonsters(xprob,hdlvl);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3 : docompletebosses(xprob,hdlvl);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4 : dolazrun(xprob,hdlvl);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;writexprob(target,xprob,10);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if hdlvl<>0 then
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;writedlvl(target,hdlvl,3)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;write(target,' &nbsp;-');
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;write(target,' &nbsp;');
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;writeln(target);
&nbsp; &nbsp; &nbsp; &nbsp;end;
&nbsp; &nbsp; &nbsp;end;

&nbsp; &nbsp;end;
&nbsp;end;
end; &nbsp;{ domagicprob }

Below are some utility functions called in various places in code posted so far:

Code:
procedure readmprob(filename:string);
var
&nbsp;mprobfile &nbsp;: text;
&nbsp;mprobdata &nbsp;: real;
&nbsp;dlvl,mslot : word;
begin
&nbsp;assign(mprobfile,filename);
&nbsp;reset(mprobfile);
&nbsp;for dlvl:=1 to lastlevel do begin
&nbsp; &nbsp;mprob[totmprobpos,dlvl]:=0;
&nbsp; &nbsp;for mslot:=0 to (totmprobpos-1) do begin
&nbsp; &nbsp; &nbsp;read(mprobfile,mprobdata);
&nbsp; &nbsp; &nbsp;mprob[mslot,dlvl]:=round(mprobdata);
&nbsp; &nbsp; &nbsp;mprob[totmprobpos,dlvl]:=mprob[totmprobpos,dlvl]+mprob[mslot,dlvl];
&nbsp; &nbsp;end;
&nbsp; &nbsp;readln(mprobfile);
&nbsp;end;
&nbsp;close(mprobfile);
end; &nbsp;{ readmprob }


function prefixpossible(islot,pslot:word):boolean;
var
&nbsp;ok : boolean;
begin
&nbsp;ok:=false;
&nbsp;case idata^[islot,12] of
&nbsp; &nbsp;12,13 &nbsp; : ok:=pdata^[pslot,20] and &nbsp;1<>0; &nbsp;{ jewlery }
&nbsp; &nbsp;3 &nbsp; &nbsp; &nbsp; : ok:=pdata^[pslot,20] and 16<>0; &nbsp;{ bow &nbsp; &nbsp; }
&nbsp; &nbsp;10 &nbsp; &nbsp; &nbsp;: ok:=pdata^[pslot,21] and &nbsp;1<>0; &nbsp;{ staff &nbsp; }
&nbsp; &nbsp;1,2,4 &nbsp; : ok:=pdata^[pslot,21] and 16<>0; &nbsp;{ weapon &nbsp;}
&nbsp; &nbsp;5 &nbsp; &nbsp; &nbsp; : ok:=pdata^[pslot,22] and &nbsp;1<>0; &nbsp;{ shield &nbsp;}
&nbsp; &nbsp;6,7,8,9 : ok:=pdata^[pslot,22] and 16<>0; &nbsp;{ armor &nbsp; }
&nbsp;end;
&nbsp;prefixpossible:=ok;
end; &nbsp;{ prefixpossible }


function suffixpossible(islot,sslot:word):boolean;
var
&nbsp;ok : boolean;
begin
&nbsp;ok:=false;
&nbsp;case idata^[islot,12] of
&nbsp; &nbsp;12,13 &nbsp; : ok:=sdata^[sslot,20] and &nbsp;1<>0; &nbsp;{ jewlery }
&nbsp; &nbsp;3 &nbsp; &nbsp; &nbsp; : ok:=sdata^[sslot,20] and 16<>0; &nbsp;{ bow &nbsp; &nbsp; }
&nbsp; &nbsp;10 &nbsp; &nbsp; &nbsp;: ok:=sdata^[sslot,21] and &nbsp;1<>0; &nbsp;{ staff &nbsp; }
&nbsp; &nbsp;1,2,4 &nbsp; : ok:=sdata^[sslot,21] and 16<>0; &nbsp;{ weapon &nbsp;}
&nbsp; &nbsp;5 &nbsp; &nbsp; &nbsp; : ok:=sdata^[sslot,22] and &nbsp;1<>0; &nbsp;{ shield &nbsp;}
&nbsp; &nbsp;6,7,8,9 : ok:=sdata^[sslot,22] and 16<>0; &nbsp;{ armor &nbsp; }
&nbsp;end;
&nbsp;suffixpossible:=ok;
end; &nbsp;{ suffixpossible }


function pcursed(pslot:word):boolean;
begin
&nbsp;pcursed:=pdata^[pslot,32]=0;
end; &nbsp;{ pcursed }


function scursed(sslot:word):boolean;
begin
&nbsp;scursed:=sdata^[sslot,32]=0;
end; &nbsp;{ scursed }


function ipossiblemonster(lvl:word):word;
var
&nbsp;i &nbsp; &nbsp; &nbsp; &nbsp;: word;
&nbsp;possible : word;
begin
&nbsp;possible:=0;
&nbsp;for i:=startbitem to ilast do begin
&nbsp; &nbsp;if lvl>=idata^[i,24] then
&nbsp; &nbsp; &nbsp;possible:=possible+idata^[i,0];
&nbsp;end;
&nbsp;ipossiblemonster:=possible;
end; &nbsp;{ ipossiblemonster }


function ipossibleboss(lvl:word):word;
var
&nbsp;i &nbsp; &nbsp; &nbsp; &nbsp;: word;
&nbsp;possible : word;
begin
&nbsp;possible:=0;
&nbsp;for i:=startbitem to ilast do begin
&nbsp; &nbsp;if (lvl>=idata^[i,24]) and (idata^[i,0]>0) and (idata^[i,56] in [0,23..26]) then
&nbsp; &nbsp; &nbsp;inc(possible);
&nbsp;end;
&nbsp;ipossibleboss:=possible;
end; &nbsp;{ ipossibleboss }


function ipossibleother(lvl:word):word;
var
&nbsp;i &nbsp; &nbsp; &nbsp; &nbsp;: word;
&nbsp;possible : word;
begin
&nbsp;possible:=0;
&nbsp;for i:=startbitem to ilast do begin
&nbsp; &nbsp;if (lvl>=idata^[i,24]) and (idata^[i,0]>0) then
&nbsp; &nbsp; &nbsp;inc(possible);
&nbsp;end;
&nbsp;ipossibleother:=possible;
end; &nbsp;{ ipossibleother }


function jpossible(lvl,islot:word):word;
var
&nbsp;i &nbsp; &nbsp; &nbsp; &nbsp;: word;
&nbsp;possible : word;
begin
&nbsp;possible:=0;
&nbsp;for i:=151 to 160 do begin
&nbsp; &nbsp;if ((idata^[islot,56])=(idata^[i,56])) and (lvl>=idata^[i,24]) then
&nbsp; &nbsp; &nbsp;inc(possible);
&nbsp;end;
&nbsp;jpossible:=possible;
end; &nbsp;{ jpossible }


function ppossible(lvl,islot:word;curseok:boolean):real;
var
&nbsp;i &nbsp; &nbsp; &nbsp; &nbsp;: word;
&nbsp;possible : real;
begin
&nbsp;possible:=0;
&nbsp;for i:=0 to plast do begin
&nbsp; &nbsp;if (lvl>=pdata^[i,16]) and ((lvl div 2)<=pdata^[i,16]) and prefixpossible(islot,i) then begin
&nbsp; &nbsp; &nbsp;if pdata^[i,32]=1 then
&nbsp; &nbsp; &nbsp; &nbsp;possible:=possible+1
&nbsp; &nbsp; &nbsp;else
&nbsp; &nbsp; &nbsp; &nbsp;if curseok then
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;possible:=possible+1/3;
&nbsp; &nbsp;end;
&nbsp;end;
&nbsp;ppossible:=possible;
end; &nbsp;{ ppossible }


function spossible(lvl,islot:word;curseok:boolean):real;
var
&nbsp;i &nbsp; &nbsp; &nbsp; &nbsp;: word;
&nbsp;possible : real;
begin
&nbsp;possible:=0;
&nbsp;for i:=0 to slast do begin
&nbsp; &nbsp;if (lvl>=sdata^[i,16]) and ((lvl div 2)<=sdata^[i,16]) and suffixpossible(islot,i) then begin
&nbsp; &nbsp; &nbsp;if sdata^[i,32]=1 then
&nbsp; &nbsp; &nbsp; &nbsp;possible:=possible+1
&nbsp; &nbsp; &nbsp;else
&nbsp; &nbsp; &nbsp; &nbsp;if curseok then
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;possible:=possible+1/3;
&nbsp; &nbsp;end;
&nbsp;end;
&nbsp;spossible:=possible;
end; &nbsp;{ spossible }


function irange(islot:word):word;
begin
&nbsp;case islot of
&nbsp; &nbsp;48..76 : irange:=idata^[islot,44]-idata^[islot,40]+1; &nbsp;{ AC }
&nbsp;else
&nbsp; &nbsp;irange:=1;
&nbsp;end;
end; &nbsp;{ irange }


function prange(pslot:word):word;
begin
&nbsp;case pslot of
&nbsp; &nbsp; 0..23 : prange:=pdata^[pslot,12]-pdata^[pslot,8]+1; &nbsp; &nbsp; &nbsp;{ range &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; &nbsp;24 : prange:=26*(pdata^[pslot,12]-pdata^[pslot,8]+1); { king's serie }
&nbsp; &nbsp; &nbsp; &nbsp;25 : prange:=21*(pdata^[pslot,12]-pdata^[pslot,8]+1); { king's serie }
&nbsp; &nbsp; &nbsp; &nbsp;26 : prange:=16*(pdata^[pslot,12]-pdata^[pslot,8]+1); { king's serie }
&nbsp; &nbsp; &nbsp; &nbsp;27 : prange:=15*(pdata^[pslot,12]-pdata^[pslot,8]+1); { king's serie }
&nbsp; &nbsp; &nbsp; &nbsp;28 : prange:=15*(pdata^[pslot,12]-pdata^[pslot,8]+1); { king's serie }
&nbsp; &nbsp; &nbsp; &nbsp;29 : prange:=15*(pdata^[pslot,12]-pdata^[pslot,8]+1); { king's serie }
&nbsp; &nbsp; &nbsp; &nbsp;30 : prange:=15*(pdata^[pslot,12]-pdata^[pslot,8]+1); { king's serie }
&nbsp; &nbsp; &nbsp; &nbsp;31 : prange:=15*(pdata^[pslot,12]-pdata^[pslot,8]+1); { king's serie }
&nbsp; &nbsp; &nbsp; &nbsp;32 : prange:=15*(pdata^[pslot,12]-pdata^[pslot,8]+1); { king's serie }
&nbsp; &nbsp; &nbsp; &nbsp;33 : prange:=25*(pdata^[pslot,12]-pdata^[pslot,8]+1); { king's serie }
&nbsp; &nbsp; &nbsp; &nbsp;34 : prange:=25*(pdata^[pslot,12]-pdata^[pslot,8]+1); { king's serie }
&nbsp; &nbsp;35..80 : prange:=pdata^[pslot,12]-pdata^[pslot,8]+1; &nbsp; &nbsp; &nbsp;{ range &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp;81..82 : prange:=1; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { F/L damage &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp;84 : prange:=pdata^[pslot,12]-pdata^[pslot,8]+1; &nbsp; &nbsp; &nbsp;{ range &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; &nbsp;85 : prange:=15*(pdata^[pslot,12]-pdata^[pslot,8]+1); { Doppel kolla }
&nbsp;else
&nbsp; &nbsp;prange:=1;
&nbsp;end;
end; &nbsp;{ prange }


function srange(sslot:word):word;
begin
&nbsp;case sslot of
&nbsp; &nbsp; 0..67 : srange:=sdata^[sslot,12]-sdata^[sslot,8]+1; &nbsp; &nbsp; &nbsp;{ range &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp;68..73 : srange:=1; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { F/L damage &nbsp; }
&nbsp; &nbsp;74..75 : srange:=sdata^[sslot,12]-sdata^[sslot,8]+1; &nbsp; &nbsp; &nbsp;{ range &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; &nbsp;76 : srange:=1; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { thorns &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp;77..97 : srange:=sdata^[sslot,12]-sdata^[sslot,8]+1; &nbsp; &nbsp; &nbsp;{ range &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp;else
&nbsp; &nbsp;srange:=1;
&nbsp;end;
end; &nbsp;{ srange }

I believ now that I have posted about everything as far as the calculations goes. I still have not been home so I can upload the actual file to my website.
There are three types of people in the world. Those who can count and those who can't.
Reply


Messages In This Thread
Item Creation in D1 - by Toverkol - 05-23-2005, 02:23 PM
Item Creation in D1 - by [vL]Kp - 05-23-2005, 03:09 PM
Item Creation in D1 - by Toverkol - 05-24-2005, 01:50 PM
Item Creation in D1 - by [vL]Kp - 05-24-2005, 02:13 PM
Item Creation in D1 - by Yogi_Baar - 05-24-2005, 02:17 PM
Item Creation in D1 - by Toverkol - 05-24-2005, 07:25 PM
Item Creation in D1 - by Fragbait - 05-24-2005, 09:57 PM
Item Creation in D1 - by Nystul - 05-25-2005, 01:44 AM
Item Creation in D1 - by Cytrex - 05-25-2005, 04:57 PM
Item Creation in D1 - by Toverkol - 05-26-2005, 01:59 AM
Item Creation in D1 - by Nystul - 05-26-2005, 09:38 AM
Item Creation in D1 - by Jarulf - 05-26-2005, 10:48 AM
Item Creation in D1 - by Toverkol - 05-26-2005, 01:29 PM
Item Creation in D1 - by the Langolier - 05-26-2005, 06:40 PM
Item Creation in D1 - by Selby - 05-27-2005, 03:48 AM
Item Creation in D1 - by Jarulf - 05-27-2005, 07:36 AM
Item Creation in D1 - by Toverkol - 05-28-2005, 03:38 AM
Item Creation in D1 - by [vL]Kp - 05-28-2005, 03:47 PM
Item Creation in D1 - by Toverkol - 05-29-2005, 09:40 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)