-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathD20BaseAttack.cpp
More file actions
57 lines (49 loc) · 1.53 KB
/
D20BaseAttack.cpp
File metadata and controls
57 lines (49 loc) · 1.53 KB
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
#include <cmath>
#include "GlobalDef.hpp"
#include "D20BaseAttack.hpp"
using namespace std;
using namespace D20Rules::Definitions;
namespace D20Rules
{
namespace Rollables
{
D20BaseAttack::D20BaseAttack()
: iMiscModifier(0),
iSizeModifier(0),
iRangePenaltyModifier(0)
{
lAttacks.push_back(0);
iterAttacks = lAttacks.begin()++;
}
void D20BaseAttack::calculateBaseAttack(Definitions::LevelType iLevel, Definitions::BaseAttackRating barRating)
{
BaseAttackType iNewBaseAttack = *(lAttacks.begin()++);
lAttacks.clear();
switch ( barRating )
{
case barGood:
lAttacks.push_back(iNewBaseAttack + iLevel);
break;
case barAverage:
for ( unsigned short int i = 2; i <= iLevel; i++ )
if ( i % 4 != 1 )
iNewBaseAttack++;
lAttacks.push_back(iNewBaseAttack);
break;
case barPoor:
lAttacks.push_back(iNewBaseAttack + iLevel / 2);
}
iterAttacks = lAttacks.begin()++;
if ( *iterAttacks > 6 )
{
lAttacks.push_back(*iterAttacks - 5);
if ( *iterAttacks > 11 )
{
lAttacks.push_back(*iterAttacks - 10);
if ( *iterAttacks > 16 )
lAttacks.push_back(*iterAttacks - 15);
}
}
}
}
}