void FightStart()
{
ypdamt = ypatk;
ypdamb = ypdef;
epdamt = epatk;
epdamb = epdef;
int yHpNew = yhp;
int eHpNew = ehp;
while (yhp >= 0 && ehp >= 0)
{
int yBattleRandom = rand() % 71 + 70;
int eBattleRandom = rand() % 71 + 70;
int yNewNum = yBattleRandom;
int eNewNum = eBattleRandom;
int ypdamf = (ypdamt*yNewNum)/ypdamb;
int epdamf = (epdamt*eNewNum)/epdamb;
cout << "you hit your enemy for " << ypdamf << " damage." << endl;
eHpNew -= ypdamf;
cout << "your enemy now has " << eHpNew << " HP left" <<endl;
if (eHpNew <= 0)
{
cout << "you have slain your enemy." << endl;
break;
}
else
{
cout << "your enemy hit you for " << epdamf << " damage." << endl;
yHpNew -= epdamf;
cout << "you now have " << yHpNew << " HP left" << endl;
if (yHpNew <= 0)
{
cout << "you are dead." << endl;
break;
}
else
{
}
}
}
}
the randoms are for basically randomizing the damage output. i need to tweek it a bit to get it right but yeah any way. my program creats a stat for crit rate. i think i decided that i wanted crit rate to max out at 999. should i create a new random number and say something like:
1 2 3 4
if (critRate > somenumber)
{
int newrandomnumber rand() 100 + 1
}
and have it basically guess itself. if that makes sense. i would write it to have newrandomnumber somehow choose a few numbers (depending on how high the crit rate is) and if it guesses correctly when generating a random number, then you do a crit strike.
im not really sure how i should go about doing this.