Jump to content

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


Monkuar
Go to solution Solved by 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

Edited by Monkuar
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.