Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include "enemyLandHitChance.h"
int enemyLandHit()
{
int enemyHit;
srand (time(NULL));
int enemyHitChance = (rand() % 100) + 1;
if (enemyHitChance<=30){
enemyHit = 0;
return enemyHit;
}
else if (enemyHitChance>30 and enemyHitChance<75){
enemyHit = 1;
return enemyHit;
//enemy hits, dealing damage = weaponDamage*playerArmour
}
else if (enemyHitChance>=75){
enemyHit = 2;
return enemyHit;
//enemy lands a critical hit, dealing damage = (weaponDamage*2*playerArmour)
//if hit = 0, attack misses. if hit = 1, attack hits with normal damage.
}
}