-
Notifications
You must be signed in to change notification settings - Fork 297
Expand file tree
/
Copy pathDragonSlayer.cpp
More file actions
29 lines (23 loc) · 918 Bytes
/
Copy pathDragonSlayer.cpp
File metadata and controls
29 lines (23 loc) · 918 Bytes
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
#include "DragonSlayer.h"
#include "Dragon.h"
//DragonSlayer::DragonSlayer
//DragonSlayer::getName
void DragonSlayer::attack(Character& other)
{
std::cout << name << " is attacking " << other.getName() << " !!" << std::endl;
if( auto* dragon = dynamic_cast<Dragon*>(&other) )
{
assert(false);
//DragonSlayers get a 10x boost when attacking dragons, from their attack item.
//so they should USE their attack item before attacking the dragon...
//note: they should only use the item if the dragon's hitpoints are > 0...
//note: items are single-use only, so you need to reset it after use.
//look in the Character class for how the other item types are reset after use.
while( dragon->getHP() > 0 )
{
dragon->takeDamage(attackDamage);
}
}
Character::attack(other);
}
//DragonSlayer::getStats