-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shadow.cpp
44 lines (39 loc) · 871 Bytes
/
Shadow.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
/*********************************************************************
** Author: Jeffrey Luong
** Date: 7/18/15
** Description: Assignment 2 - Shadow Implementation File
*********************************************************************/
#include "Shadow.hpp"
int Shadow::attack()
{
int numDiceFace = 10;
int numDice = 2;
int attackTotal = 0;
for(int x = 0; x < numDice; x++)
{
attackTotal += rollDice(numDiceFace);
}
return attackTotal;
};
int Shadow::defend()
{
int numDiceFace = 6;
int numDice = 1;
int defendTotal = 0;
int dodge = rand() % 2 + 1;
//50% chance to achieve dodge.
if (dodge == 1)
{
for(int x = 0; x < numDice; x++)
{
defendTotal += rollDice(numDiceFace);
}
return defendTotal;
}
else
{
//Shadow will have a impregnable armor to reduce damage
defendTotal = 9999;
return defendTotal;
}
};