-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbomb.cpp
More file actions
33 lines (30 loc) · 687 Bytes
/
Copy pathbomb.cpp
File metadata and controls
33 lines (30 loc) · 687 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
30
31
32
33
#include "bomb.h"
#include "avatarspirit.h"
Bomb::Bomb()
{
_type = BOMB;
_color = Qt::black;
_life = 1;
}
Bomb::~Bomb()
{
}
void Bomb::act()
{
QList<Spirit *> colliding_spirits = collidingSpirits();
if (colliding_spirits.empty())
{
return;
}
else
{
for (QList<Spirit *>::iterator it = colliding_spirits.begin(); it != colliding_spirits.end(); ++it)
{
Spirit::SType type = (*it)->spiritType();
if ((type == MOUSE || type == CAT || type == ELEPHANT) && dynamic_cast<AvatarSpirit *>(*it)->isAwake())
{
this->injured(1.0); // blow up a bomb
}
}
}
}