static void testCommuns(FragTrap &ft, ScavTrap &st) { FragTrap copy(ft); FragTrap test = copy; ft.takeDmg(35); ft.takeDmg(35); ft.takeDmg(100); ft.beRepaired(80); ft.beRepaired(80); ft.rangeAttack("farfaraway"); ft.meleeAttack("closeTaget"); ScavTrap ccopy(st); ScavTrap ttest = ccopy; st.takeDmg(35); st.takeDmg(35); st.takeDmg(100); st.beRepaired(80); st.beRepaired(80); st.rangeAttack("farfaraway"); st.meleeAttack("closeTaget"); }
static void testScavSpecials(ScavTrap &st) { st.challengeNewcommer("poorNewcommer"); st.challengeNewcommer("poorNewcommer"); st.challengeNewcommer("poorNewcommer"); st.challengeNewcommer("poorNewcommer"); st.challengeNewcommer("poorNewcommer"); }
int main( void ) { int i; srand(time(0)); FragTrap ft = FragTrap( ); FragTrap ft2 = FragTrap("Kakashi-Sensei"); FragTrap ft3 = FragTrap(ft2); std::cout << std::endl; std::cout << "Started with " << ft2.getName( ) << std::endl; i = 0; while ( i < 5 ) { ft2.vaulthunter_dot_exe( "Vickings" ); std::cout << std::endl; i++; } std::cout << std::endl; std::cout << std::endl; ScavTrap st = ScavTrap( ); ScavTrap st2 = ScavTrap("CL4P-TP"); ScavTrap st3 = ScavTrap(st2); std::cout << std::endl; std::cout << "Started with " << st2.getName( ) << std::endl; i = 0; while ( i < 3 ) { st2.challengeNewcomer("pourquoi stp"); std::cout << std::endl; i++; } std::cout << std::endl; std::cout << std::endl; ClapTrap ct = ClapTrap("SIMPLE"); NinjaTrap nt = NinjaTrap("Naruto-san"); NinjaTrap nt2 = NinjaTrap("Sasuke-san"); std::cout << std::endl; std::cout << "start with the ninja : " << st.getName( ) << std::endl; nt.ninjaShoebox( ct ); nt.ninjaShoebox( nt2 ); nt.ninjaShoebox( ft2 ); nt.ninjaShoebox( st2 ); std::cout << std::endl; std::cout << std::endl; return 0; }
static void testScavSpecials(ScavTrap &st) { std::cout << std::endl << "SCAV SPE TESTS" << std::endl; st.challengeNewcommer("poorNewcommer"); st.challengeNewcommer("poorNewcommer"); st.challengeNewcommer("poorNewcommer"); st.challengeNewcommer("poorNewcommer"); st.challengeNewcommer("poorNewcommer"); }
static void testCommuns(FragTrap &ft, ScavTrap &st, NinjaTrap &nt, SuperTrap &sut) { std::cout << std::endl << "STD TESTS" << std::endl; FragTrap copy(ft); FragTrap test = copy; ft.takeDmg(35); ft.takeDmg(35); ft.takeDmg(100); ft.beRepaired(80); ft.beRepaired(80); ft.rangeAttack("farfaraway"); ft.meleeAttack("closeTaget"); ScavTrap ccopy(st); ScavTrap ttest = ccopy; st.takeDmg(35); st.takeDmg(35); st.takeDmg(100); st.beRepaired(80); st.beRepaired(80); st.rangeAttack("farfaraway"); st.meleeAttack("closeTaget"); NinjaTrap cccopy(nt); NinjaTrap tttest = cccopy; nt.takeDmg(35); nt.takeDmg(35); nt.takeDmg(100); nt.beRepaired(80); nt.beRepaired(80); nt.rangeAttack("farfaraway"); nt.meleeAttack("closeTaget"); SuperTrap ccccopy(sut); SuperTrap ttttest = ccccopy; sut.takeDmg(35); sut.takeDmg(35); sut.takeDmg(100); sut.beRepaired(80); sut.beRepaired(80); sut.rangeAttack("farfaraway"); sut.meleeAttack("closeTaget"); }
void attack(ScavTrap & 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.challengeNewcomer(p2.getName())) != 0) p2.takeDamage(nb_dmg); } }
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 NinjaTrap::ninjaShoebox(ScavTrap const &target) { if (this->_mp < 40) { std::cout << "N1NJ4-TP " << this->_name << ": Not enough mana." << std::endl; return ; } std::string t[] = { "dance!", "eat my shoes!", "chew what?", "hold my box..." }; // srand(static_cast<unsigned int>(time(NULL))); //TODO: bjorked? this->_mp -= 40; std::cout << "N1NJ4-TP " << this->_name << ": Come here SCAVTRAP " << target.getName() << ", and " << t[rand() % static_cast<int>(sizeof(t) / sizeof(*t))] << std::endl; }
void NinjaTrap::ninjaShoebox(ScavTrap & target) { std::string r[5] = {"Scav Boost", "Scav Drop", "Scav Fufu", "Scav Yeah", "Scav Unless"}; int rand = std::rand() % 5; std::string attack = r[rand]; std::cout << "NINJA-TP " << this->getName() << " attacks " << "\033[38;5;84m" << attack << "\033[0m " << target.getName() << " at range, causing " << this->getMeleeAtkDmg() << " points of damage !" << std::endl; }
void NinjaTrap::ninjaShoebox(const ScavTrap& scav) const { std::cout << "NINJA : " << _name << " put his SHADOW BLADE in the " << scav.name() << " SCAV weak's body, causing 42 Damage points" << std::endl; }
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; }