bool Colosseum::attack(const Pokemon& attacker, Pokemon& defender) //function that deals with attacks and lowers hit points if hit { bool returnValue=false; cout << attacker.get_name() << " is attacking " << defender.get_name() << endl; int attbonus=d20.roll(); int defbonus=d20.roll(); cout << attacker.get_name() << " rolls an attack bonus of " << attbonus << endl; cout << defender.get_name() << " rolls an defense bonus of " << defbonus << endl; int total_att=attbonus+attacker.get_attackLevel(); int total_def=defbonus+defender.get_defLevel(); int damage; if(total_att>total_def) { int roll1=d6.roll(); int roll2=d6.roll(); int roll3=d6.roll(); damage=roll1+roll2+roll3; cout << "The attack hits dealing 3-D6 damage!" << endl; cout << "The rolls are: " << roll1 << " " << roll2 << " " << roll3 << " totalling: " << damage << " damage!" << endl; defender.reduceHP(damage); if(defender.get_hp() <=0 ) { returnValue=true; } else { returnValue=false; cout << defender.get_name() << " has " << defender.get_hp() << " hit points left." << endl; } } else { damage=0; cout << "The attack is missed!" << endl; } return returnValue; }