1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
int main()
{
Character player("Hero", 100, 1, 0);
Character goblin("Goblin", 30, 1, 0);
Character orc("Orc", 42, 1, 0);
Character dragon("Dragon", 500, 1, 0);
std::vector<Character> enemyList{ goblin, orc, dragon };
Attack slash("Slash", 4, 1, 1, 20);
Attack scratch("Scratch", 1, 1, 25, 25);
Attack fireBlast("Fire Blast", 12, 1, 15, 15);
Attack stomp("Stomp", 7, 1, 25, 25);
Attack orcSword("Orc Sword", 9, 1, 13, 13);
Attack punch("Punch", 3, 1, 20, 20);
Attack kick("Kick", 5, 1, 15, 15);
Attack rifle("Assault Rifle", 15, 1, 30, 30);
Attack handgun("Handgun", 10, 1, 8, 36);
goblin.LearnAttack(stomp);
goblin.LearnAttack(scratch);
goblin.LearnAttack(punch);
orc.LearnAttack(orcSword);
orc.LearnAttack(punch);
orc.LearnAttack(kick);
dragon.LearnAttack(slash);
dragon.LearnAttack(fireBlast);
dragon.LearnAttack(stomp);
player.LearnAttack(rifle);
player.LearnAttack(handgun);
for (auto& enemy : enemyList)
{
if (enemy.GetAttacks().empty())
{
std::cout << enemy.GetName() << " has no attacks!\n";
}
}
| |