Exemple #1
0
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");

}
Exemple #2
0
static void testFragSpecials(FragTrap &ft)
{
    ft.vaulthunter_dot_exe("poorBandit");
    ft.vaulthunter_dot_exe("poorBandit");
    ft.vaulthunter_dot_exe("poorBandit");
    ft.vaulthunter_dot_exe("poorBandit");
    ft.vaulthunter_dot_exe("poorBandit");
}
Exemple #3
0
static void testFragSpecials(FragTrap &ft)
{
    std::cout << std::endl << "FRAG SPE TESTS" << std::endl;
    
    ft.vaulthunter_dot_exe("poorBandit");
    ft.vaulthunter_dot_exe("poorBandit");
    ft.vaulthunter_dot_exe("poorBandit");
    ft.vaulthunter_dot_exe("poorBandit");
    ft.vaulthunter_dot_exe("poorBandit");
}
Exemple #4
0
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");
}
Exemple #5
0
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);
}
Exemple #6
0
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 ;
}
Exemple #7
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);
	}
}
Exemple #8
0
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);
}
Exemple #9
0
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;
}
Exemple #11
0
FragTrap::FragTrap(const FragTrap& fp) :
    ClapTrap(fp)
{
    (void)fp;
    std::cout << "Copy constructor from : " << fp.name() << " (FragTrap) ( clone is bad :( )" << std::endl;
}
Exemple #12
0
void	NinjaTrap::ninjaShoebox(const FragTrap& frag) const
{
	std::cout << "NINJA : " << _name
		<< " put his SHADOW BLADE in the " << frag.name()
		<< " FRAG weak's body, causing 42 Damage points" << std::endl;
}
Exemple #13
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)
: ClapTrap(src.getName())
{
	*this = src;
	return ;
}
Exemple #15
0
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;
}
Exemple #16
0
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;
}