-
Notifications
You must be signed in to change notification settings - Fork 0
/
spy_miner.cpp
55 lines (45 loc) · 1.07 KB
/
spy_miner.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
#include "spy_miner.h"
#include "board.h"
// board.h in scout?
/* name: constructor */
/* desc: calls the parent's contructor and passes it an */
/* 8. */
/* params: none */
/* return: n/a */
miner::miner(int team, image * h, image * r)
: soldier(team, 8, h, r)
{
}
/* name: attack */
/* desc: if attacking a mine, return 1, */
/* else call the parent's method */
/* params: piece * enemy */
int miner::attack(piece * enemy)
{
if ( enemy->is_bomb() )
return 1;
return soldier::attack(enemy);
}
/* name: constructor */
/* desc: calls the parent's contructor and passes it an */
/* 10. */
/* params: none */
/* return: n/a */
spy::spy( int team, image * h, image * r )
: soldier(team, 10, h, r)
{
}
/* name: attack */
/* desc: if attacking a 1, return 1, */
/* else call the parent's method */
/* params: piece * enemy */
int spy::attack(piece * enemy)
{
if ( enemy->is_soldier() )
{
soldier * s = (soldier*) enemy;
if ( s->get_rank() == 1 )
return 1;
}
return soldier::attack(enemy);
}