mastercjb Posted May 9, 2009 Share Posted May 9, 2009 I just added shoes as a % booster to fight. So if Person (A) has 10,000 speed, and person (B) has 10,001 but Person (A) has shoe's increasing speed by say 10% then person (A) would hit first. Here is the code im adding it to, I cant seem to code it with the shoes: $yourhp = $user_class->hp; $theirhp = $attack_person->hp; ?> <tr><td class="contenthead">Fight House</td></tr> <tr><td class="contentcontent">You are in a fight with <? echo $attack_person->formattedname ?>.</td></tr> <tr><td class="contentcontent"> <? $wait = ($user_class->speed > $attack_person->speed) ? 1 : 0; while($yourhp > 0 && $theirhp > 0){ $damage = $attack_person->moddedstrength - $user_class->moddeddefense; $damage = ($damage < 1) ? 1 : $damage; if($wait == 0){ $yourhp = $yourhp - $damage; echo $attack_person->formattedname . " hit you for " . $damage . " damage using their ".$attack_person->weaponname.". <br>"; } else { $wait = 0; } if($yourhp > 0) { $damage = $user_class->moddedstrength - $attack_person->moddeddefense; $damage = ($damage < 1) ? 1 : $damage; $theirhp = $theirhp - $damage; echo "You hit " . $attack_person->formattedname . " for " . $damage . " damage using your ".$user_class->weaponname.". <br>"; } Link to comment https://forums.phpfreaks.com/topic/157518-adding-speed-to-a-fight-php-script/ Share on other sites More sharing options...
Ken2k7 Posted May 9, 2009 Share Posted May 9, 2009 I guess you would increase $user_class->speed by the percent? I don't know what's in your user_class, but then again, that's not my problem. Link to comment https://forums.phpfreaks.com/topic/157518-adding-speed-to-a-fight-php-script/#findComment-830490 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.