-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplant.cpp
More file actions
57 lines (40 loc) · 1.29 KB
/
plant.cpp
File metadata and controls
57 lines (40 loc) · 1.29 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 "plant.h"
Plant::Plant(int H, int d, int atra, int icost, bool isr, bool isp, bool isz, QString n, bool ifl)
: Creature(H, d, atra, isr, isp, isz, ifl, n, icost)
{
}
RemotePlant::RemotePlant(int H, int d, int atra, QString n, int icost, bool isr, bool isp, bool isz)
: Plant(H, d, atra, icost, isr, isp, isz, n)
{
}
MellePlant::MellePlant(int H, int d, int atra, QString n, int icost, bool isr, bool isp, bool isz)
: Plant(H, d, atra, icost, isr, isp, isz, n)
{
}
PeaShooter::PeaShooter(int H, int d, int atra, QString n, int icost)
: RemotePlant(H, d, atra, n, icost)
{
}
BigMouth::BigMouth(int H, int d, int atra, QString n, int icost)
: MellePlant(H, d, atra, n, icost)
{
}
WallNut::WallNut(int H, int d, int atra, QString n, int icost)
: MellePlant(H, d, atra, n, icost)
{
}
bool PeaShooter::canAttack(Creature *crt) {
if ((abs(crt->getCx() - getCx()) <= 1) && crt->getCy() - getCy() <= getAttackRange()) {
return true;
}
return false;
}
bool BigMouth::canAttack(Creature *crt) {
if ((abs(crt->getCx() - getCx()) <= 1) && (abs(crt->getCy() - getCy()) <= 1) && !crt->getIs_fly()) {
return true;
}
return false;
}
bool WallNut::canAttack(Creature *) {
return false;
}