-
Notifications
You must be signed in to change notification settings - Fork 0
/
chest.cpp
65 lines (62 loc) · 1.47 KB
/
chest.cpp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "chest.h"
Chest::Chest()
: ItemsOnScene(Qt::yellow, 0, 0, 20, 10)
{
height = 5;
}
void Chest::open(Hero *opener, MessageAtTopOfScreen * messageAtTopOfScreen)
{
switch (content)
{
case 0:
opener->addGrenades(1);
messageAtTopOfScreen->showMessage("You received: grenade(1)");
break;
case 1:
opener->refillCurrentOwnedAmmo();
messageAtTopOfScreen->showMessage("You received: refill current owned ammo");
break;
case 2:
opener->refillCurrentLoadedAmmo();
messageAtTopOfScreen->showMessage("You received: refill current loaded ammo");
break;
case 3:
opener->gun()->addAmmo(20);
messageAtTopOfScreen->showMessage("You received: ammo(20)");
break;
case 4:
opener->addHP(5);
messageAtTopOfScreen->showMessage("You received: hp(5)");
break;
case 5:
opener->addArmor(5);
messageAtTopOfScreen->showMessage("You received: armor(5)");
break;
}
delete this;
}
void Chest::open(Hero *opener)
{
switch (content)
{
case 0:
opener->addGrenades(1);
break;
case 1:
opener->refillCurrentOwnedAmmo();
break;
case 2:
opener->refillCurrentLoadedAmmo();
break;
case 3:
opener->gun()->addAmmo(20);
break;
case 4:
opener->addHP(5);
break;
case 5:
opener->addArmor(5);
break;
}
delete this;
}