PDA

View Full Version : Old school runescape Max hit calculater



rj
05-12-2014, 02:36 AM
97.7% accurate. For some reason the results differ from the Java version I made (which is 100% accurate because I use the formula that has been posted by Jagex)

type
prayer = (PRAYER_NONE, BURST_OF_STRENGTH, SUPERHUMAN_STRENGTH, ULTIMATE_STRENGTH, CHIVARLY, PIETY);
potion = (POTION_NONE, STRENGTH, SUPER_STRENGTH);
attackStyle = (CONTROLLED, AGRESSIVE, DEFENSE);

const
STRENGTH_LEVEL = 99;
EQUIPBONUS = 54;
PRAY = prayer.PRAYER_NONE;
STYLE = attackStyle.AGRESSIVE;
POT = potion.POTION_NONE;


function maxHit(level, strBonus:integer; prayType:prayer; styleType:attackStyle; potionType:potion):extended;
var
styleBonus:integer;
strengthLevel:integer = STRENGTH_LEVEL;
cumulativeStr, maxHit:extended;

begin

case styleType of
CONTROLLED : styleBonus := 1;
AGRESSIVE : styleBonus := 3;
DEFENSE : styleBonus := 0;
end;

case prayType of
BURST_OF_STRENGTH : strengthLevel := round(strengthLevel * 1.05);
SUPERHUMAN_STRENGTH : strengthLevel := round(strengthLevel * 1.10);
ULTIMATE_STRENGTH : strengthLevel := round(strengthLevel * 1.15);
CHIVARLY : strengthLevel := round(strengthLevel * 1.18);
PIETY : strengthLevel := round(strengthLevel * 1.23);
end;

case potionType of
STRENGTH : strengthLevel := round(strengthLevel * 1.12);
SUPER_STRENGTH : strengthLevel := 5 + round(strengthLevel * 1.15);
end;

cumulativeStr := (strengthLevel + styleBonus);
maxHit := ((13 + (cumulativeStr) + (strBonus / 8) + ((cumulativeStr * strBonus) / 64)));

if (maxHit < 1) then
maxHit := 1
else
maxHit := floor(maxHit);

result := maxHit / 10;
end;

function maxHit(level, strBonus:integer):extended; overload;
begin
result := maxHit(level, strBonus, prayer.PRAYER_NONE, attackStyle.AGRESSIVE, potion.POTION_NONE);
end;


begin
writeln(maxHit(STRENGTH_LEVEL, EQUIPBONUS, PRAY, STYLE, POT));
end.

samerdl
05-12-2014, 03:47 PM
Nice script robert. ;)