Listed below is a formula i created by using my user-stats to form a "critical hit chance". As you can see it's supposed to be out of 100% chance..
If i had say 56% critical hit chance ($critting) then the forumla should, and does, read rand(56,100); but this doesn’t give me a chance out of 100… the chance $critting even at 56% is more like 4% chance.
Can anyone solve this?
$luck2 = ceil($userrow["luck"]*9);
$luck3 = ceil($luck2 / 100);
$dex1 = ceil($userrow["dexterity"]*12);
$dex2 = ceil($dex1 / 100);
$int1 = ceil($userrow["intelligence"]*6);
$int2 = ceil($int1 / 100);
$timebased = ceil($userrow["turns"] * 10) / 3;
$timecrit = ceil($timebased / 100);
$critting = $dex2 + $luck3 + $int2 + $timecrit;
$toblock = ceil(rand($monsterrow["armor"]*.75,$monsterrow["armor"])/3);
$tocrit = rand($critting,100);
if ($tocrit == 100) { $tohit = $tohit * 2; $pagearray["yourturn"] .= "Critical hit!<br />";
$query = doquery("INSERT INTO {{table}} SET id='',time=NOW(),user='<font color=orange>".$userrow["charname"]."</font>',news='<font color=orange>Has critically hit $monstername for $tohit damage!</font>'", "events");
}