Jump to content

need help with critical strikes..... (DAMAGE)


Monkuar

Recommended Posts

example:

 
//Calculate monster damage...
$monsterdamage = rand($monsterdata['damage']/2, $monsterdata['damage']);
if ($monsterdamage == $monsterdata['damage']/2){
$monstertext = ' missed <i>part of</i> his attack, dealing '.($monsterdata['damage']/2).' damage!';
}else{
$monstertext = ' hit you with '.$monsterdamage.' damage!';
}

Example if $monsterdata['damage'] = 10 or 20, it works fine, but if it's like 500 or 200, the chance for it to equal the same is very LOW.

 

I'm looking for something like:

 

-> 10% chance to deal Critical strike (*2) regardless of the $monsterdata['damage'] variable, even if it's over 9000.

 

-> 20% chance to deal a finishing blow(*2.3) damage, or whatever, you get the idea? Any help? Thanks!

 

 

I'm just confused because if the  $monsterdata['damage'] is like 5000, how would I calculate of this number having a 10% chance to do a critical strike as in-compared to  $monsterdata['damage'] mob being just 250 damage? LOL I'm lost

Link to comment
https://forums.phpfreaks.com/topic/278551-need-help-with-critical-strikes-damage/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.