-
Notifications
You must be signed in to change notification settings - Fork 0
/
witch.cpp
35 lines (31 loc) · 847 Bytes
/
witch.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
#include "witch.h"
Witch::Witch()
{
potionAvailable[0] = potionAvailable[1] = true;
}
void Witch::use(enum potion potion, Player *playerID)
{
if (myGame.getDaytime() == Game::night && validAction(playerID) && potionAvailable[potion] && myGame.getNightCount() > 1) //using potions in the first night is prohibited
{
currentPotion = potion;
target = playerID;
switch (potion)
{
case deathPotion:
potionAvailable[potion] = false;
break;
case shieldPotion:
//set protect value, like bodyguard shield only destroyed if player was attacked
potionAvailable[potion] = false;
break;
}
}
}
Player *Witch::getTarget() const
{
return target;
}
Witch::potion Witch::getCurrentPotion() const
{
return currentPotion;
}