int main( void ) { FragTrap* robot = new FragTrap("ClapTrap"); ScavTrap* robote = new ScavTrap("C3PO"); robot->rangedAttack("C3PO"); robote->rangedAttack("ClapTrap"); robot->meleeAttack("C3PO"); robote->meleeAttack("ClapTrap"); robot->takeDamage(60); robote->takeDamage(60); robot->takeDamage(30); robote->takeDamage(30); ScavTrap* Noobbot = new ScavTrap("C3PO"); Noobbot = robote; Noobbot->takeDamage( 50 ); robot->vaulthunter_dot_exe("C3PO"); robote->challengeNewcomer("ClapTrap"); robot->takeDamage(20); robot->beRepaired(101); robot->vaulthunter_dot_exe("C3PO"); robote->challengeNewcomer("ClapTrap"); robot->vaulthunter_dot_exe("C3PO"); robote->challengeNewcomer("ClapTrap"); robot->vaulthunter_dot_exe("C3PO"); robote->challengeNewcomer("ClapTrap"); robot->vaulthunter_dot_exe("C3PO"); robote->challengeNewcomer("ClapTrap"); robot->takeDamage(150); robote->takeDamage(150); delete robot; delete robote; }
int main(void) { srand(time(NULL)); FragTrap *Clappy = new FragTrap("Clappy"); ScavTrap *Scavy = new ScavTrap("Scavy"); std::cout << "\033[35m"; Clappy->takeDamage(42); std::cout << "\033[36m"; Scavy->takeDamage(42); std::cout << std::endl << std::endl; std::cout << "\033[35m"; Clappy->vaulthunter_dot_exe("Scavy"); std::cout << "\033[36m"; Scavy->challengeNewcomer(); std::cout << std::endl << std::endl; std::cout << "\033[35m"; Clappy->meleeAttack("Scavy"); std::cout << "\033[36m"; Scavy->meleeAttack("Clappy"); std::cout << std::endl << std::endl; std::cout << "\033[35m"; Clappy->rangedAttack("Scavy"); std::cout << "\033[36m"; Scavy->rangedAttack("Clappy"); std::cout << std::endl << std::endl; std::cout << "\033[35m"; Clappy->beRepaired(42); std::cout << "\033[36m"; Scavy->beRepaired(42); std::cout << std::endl << std::endl; std::cout << "\033[35m"; Clappy->print_status(); std::cout << "\033[36m"; Scavy->print_status(); delete Clappy; delete Scavy; return (0); }
void attack(FragTrap & p1, ClapTrap & p2) { int rand1 = rand() % 3; unsigned int nb_dmg; if (rand1 == 0) { p1.rangedAttack(p2.getName()); p2.takeDamage(p1.getRanged_attack_dmg()); } else if (rand1 == 1) { p1.meleeAttack(p2.getName()); p2.takeDamage(p1.getMelee_attack_dmg()); } else { if ((nb_dmg = p1.vaulthunter_dot_exe(p2.getName())) != 0) p2.takeDamage(nb_dmg); } }
int main(int, char**) { srand(time(0)); FragTrap lol = FragTrap("lol"); lol.rangedAttack("Paul"); lol.meleeAttack("Paul"); lol.takeDamage(25); lol.beRepaired(5); lol.vaulthunter_dot_exe("Paul"); lol.takeDamage(65); lol.beRepaired(3); lol.vaulthunter_dot_exe("Paul"); lol.takeDamage(5); lol.beRepaired(3); lol.vaulthunter_dot_exe("Paul"); lol.takeDamage(2); lol.takeDamage(5); lol.vaulthunter_dot_exe("Paul"); lol.beRepaired(3); lol.takeDamage(25); return 0; }
int main() { FragTrap bot; FragTrap * jean = new FragTrap("Jean"); bot.meleeAttack(jean->getName()); jean->takeDamage(bot.getMeleeDmg()); jean->rangedAttack(bot.getName()); bot.takeDamage(jean->getRangedDmg()); bot.beRepaired(20); FragTrap * jeanbis = new FragTrap(*jean); jean->meleeAttack(jeanbis->getName()); jeanbis->takeDamage(jean->getMeleeDmg()); jeanbis->vaulthunter_dot_exe(bot.getName()); delete jean; delete jeanbis; }