/
D20SavingThrow.cpp
51 lines (46 loc) · 975 Bytes
/
D20SavingThrow.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
#include "GlobalDef.hpp"
#include "D20SavingThrow.hpp"
using namespace D20Rules::Definitions;
using namespace Loki;
namespace D20Rules
{
namespace Rollables
{
D20SavingThrow::D20SavingThrow(BaseType iNewBase, MiscType iNewMisc)
: Rollable(iNewBase + iNewMisc)
{
}
D20SavingThrow::D20SavingThrow()
: iBase(0),
iMisc(0),
iTemp(0)
{
}
void D20SavingThrow::addBase(LevelType iLevel, SavingThrowRating strRating)
{
BaseType iCurrentBase = iBase;
switch ( strRating )
{
case strGood:
iBase += (2 + iLevel / 2) - iCurrentBase;
break;
case strPoor:
iBase += (iLevel / 3) - iCurrentBase;
break;
};
}
void D20SavingThrow::removeBase(LevelType iLevel, SavingThrowRating strRating)
{
BaseType iCurrentBase = iBase;
switch ( strRating )
{
case strGood:
iBase -= (2 + iLevel / 2) - iCurrentBase;
break;
case strPoor:
iBase -= (iLevel / 3) - iCurrentBase;
break;
};
}
}
}