int main(void) { std::srand(std::time(0)); FragTrap a("robot-gila"); FragTrap b; FragTrap c = a; FragTrap d("Reparator "); //FragTrap b; a.rangedAttack("poulet"); b.meleeAttack(a.getName()); a.takeDamage(50); b.meleeAttack(a.getName()); a.takeDamage(50); b.meleeAttack(a.getName()); a.takeDamage(50); d.vaulthunter_dot_exe(b.getName()); a.beRepaired(90); d.vaulthunter_dot_exe(b.getName()); a.beRepaired(100); d.vaulthunter_dot_exe(b.getName()); d.vaulthunter_dot_exe(b.getName()); d.vaulthunter_dot_exe(b.getName()); d.vaulthunter_dot_exe(b.getName()); //FragTrap b(a); 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; }
FragTrap::FragTrap(FragTrap const & src) : _name(src.getName()), _hitPoints(src.getHitPoints()), _maxHitPoints(src.getMaxHitPoints()), _energyPoints(src.getEnergyPoints()), _maxEnergyPoints(src.getMaxEnergyPoints()), _level(src.getLevel()), _meleeAttackDamage(src.getMeleeAttackDamage()), _rangedAttackDamage(src.getRangedAttackDamage()), _armorDamageReduction(src.getArmorDamageReduction()) { srand(time(0)); std::cout << "FR4G-TP <" << this->_name << "> created : Look out everybody! Things are about to get awesome!" << std::endl << std::endl; return ; }
void NinjaTrap::ninjaShoebox(FragTrap 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 FRAGTRAP " << target.getName() << ", and " << t[rand() % static_cast<int>(sizeof(t) / sizeof(*t))] << std::endl; }
void NinjaTrap::ninjaShoebox(FragTrap & target) { std::string r[5] = {"Frag Boost", "Frag Drop", "Frag Fufu", "Frag Yeah", "Frag 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; }
FragTrap::FragTrap(FragTrap const & src) : ClapTrap(src.getName()) { *this = src; return ; }