Ok so basically the beercanbliltz attack is supposed to double all the senior opponents attack power and can only be used once. I also want seniors health to decrement by 25 when he uses it. I changed my code to have a flag to know when it has been used but I don't know how to double the attacks persay..
Code:
class senior:public teacher{
private:
bool blitz;
public:
int headbutt();
int beercanblitz(int force);
bool didbeercanblitz();
void changebeercanblitz(bool);
void setHealth();
senior();
~senior();
};
senior::senior(){
health = 100;
blitz = false;
}
senior::~senior(){
}
bool senior::didbeercanblitz(){
return blitz;
}
void senior::changebeercanblitz(bool state){
blitz = state;
}
int senior::beercanblitz(int force){
return 2 * force;
}
int senior::headbutt(){
return 20;
}
void senior::setHealth(){
health = 100;
}
In Main....
Code:
/* Senior's Attack */
cout<<endl;
if(enemyAttack == 1){
if(attack == 5){
f1.reduceHealth(f1.block(flag * f5.punch()));
}
else{
f1.reduceHealth(f5.punch());
cout<<"Your Health: ";
f1.showHealth();
}
cout<<"Super Human Senior Punched You!!"<<endl;
cout<<"Your Health: ";
f1.showHealth();
}
else if(enemyAttack == 2){
if(attack == 5){
f1.reduceHealth(f1.block(flag * f5.kick()));
}
else{
f1.reduceHealth(f5.kick());
cout<<"Your Health: ";
f1.showHealth();
}
cout<<"Super Human Senior Kicked You!!"<<endl;
cout<<"Your Health: ";
f1.showHealth();
}
else if (enemyAttack == 3){
cout<<"Super Human Senior blocked the attack"<<endl;
}
else if(enemyAttack == 4){
if(attack == 5){
f1.reduceHealth(f1.block(f5.headbutt()));
cout<<"Your Health: ";
f1.showHealth();
}
else{
f1.reduceHealth(f5.headbutt());
}
cout<<"Super Human Senior Headbutts You!!"<<endl;
cout<<"Your Health: ";
f1.showHealth();
}
else if(enemyAttack == 5){
if (!f5.didbeercanblitz()){
f5.changebeercanblitz(true);
flag = 2;
}
else {
flag = 1;
}
/* f1.reduceHealth(f5.beercanblitz(f5.kick()));
f1.reduceHealth(f5.beercanblitz(f5.headbutt()));
cout<<"Super Human Senior USES BEER CAN BLITZ!!"<<endl;
cout<<"Your Health: ";
*/
f1.showHealth();
}
/*Check for Winner*/
if(f5.getHealth() <= 0 && f1.getHealth() > 0){
cout<<endl;
cout<<"You Killed the Super Human Senior!!"<<endl;
cout<<"Your Health: ";
f1.showHealth();
seniorOpponent--;
if(seniorOpponent > 0){
f5.setHealth();
}
}
}