/********************************************************************************* *Description - Defense fn *fn that send number of die and faces to Arena class and assesses the amount of *damage received *Parameters - Passes the amount of damage received to the the Armor fn, using polymorphism *********************************************************************************/ void Reptile::defense() { int defend, damage, impact; battle3.setNumFaces(R_DEFEND_FACE); battle3.setNumDice(R_DEFEND_DIE); defend = battle3.Roll(); battle3.setDefendRoll(defend); damage = battle3.deathBlow(); if(damage == 0) { cout << "No damage!!" << endl; } else if(damage > R_ARMOR) { impact = damage - R_ARMOR; cout << "The Reptile People were injured! Because of armor, it only had an impact of: -"<< impact << endl; } else if((damage > 0) && (damage <= R_ARMOR)) { cout << "The Reptile People were hit, but were saved by their armor!!" << endl; } Character *chr = &rep; chr->armor(damage); chr->strength(); }
/********************************************************************************* *Description - Attack fn Fn that passes number of die and die faces to Arena fn *Parameters - CONST for number of die and die faces *********************************************************************************/ void Reptile::attack() { int attack; battle3.setNumFaces(R_ATTACK_FACE); battle3.setNumDice(R_ATTACK_DIE); attack = battle3.Roll(); cout << "The Reptile People delivered a heavy blow to the opponent with a force of: " << attack << endl; battle3.setAttackRoll(attack); }