ScummVM API documentation
ai_defenseunit.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef SCUMM_HE_MOONBASE_AI_DEFENCEUNIT_H
23 #define SCUMM_HE_MOONBASE_AI_DEFENCEUNIT_H
24 
25 namespace Scumm {
26 
27 class AI;
28 
29 enum {
30  DUT_ANTI_AIR = 1,
31  DUT_SHIELD = 2,
32  DUT_MINE = 3,
33  DUT_HUB = 4,
34  DUT_TOWER = 5,
35  DUT_BRIDGE = 6,
36  DUT_ENERGY = 7,
37  DUT_OFFENSE = 8,
38  DUT_CRAWLER = 9
39 };
40 
41 enum {
42  DUS_ON = 1,
43  DUS_OFF = 2,
44  DUS_DESTROYED = 3
45 };
46 
47 class DefenseUnit {
48 private:
49  int _id;
50  Common::Point _pos;
51  int _distanceTo;
52  int _state;
53  int _radius;
54  int _armor;
55  int _cost;
56 
57 protected:
58  AI *_ai;
59 
60 public:
61  DefenseUnit(AI *ai);
62  DefenseUnit(DefenseUnit *inUnit, AI *ai);
63 
64  virtual ~DefenseUnit();
65 
66  void setID(int id) { _id = id; }
67  void setDistanceTo(int distanceTo) { _distanceTo = distanceTo; }
68  void setState(int state) { _state = state; }
69  void setRadius(int radius) { _radius = radius; }
70  void setArmor(int armor) { _armor = armor; }
71  void setDamage(int damage) { _armor -= damage; }
72  void setPos(int x, int y) {
73  _pos.x = x;
74  _pos.y = y;
75  }
76  void setCost(int cost) { _cost = cost; }
77 
78  int getID() const { return _id; }
79  int getDistanceTo() const { return _distanceTo; }
80  int getState() const { return _state; }
81  int getRadius() const { return _radius; }
82  int getArmor() const { return _armor; }
83  int getPosX() const { return _pos.x; }
84  int getPosY() const { return _pos.y; }
85  int getCost() const { return _cost; }
86 
87  virtual int getType() const = 0;
88 
89  virtual Common::Point *createTargetPos(int index, int distance, int weaponType, int sourceX, int sourceY) = 0;
90  virtual int selectWeapon(int index) = 0;
91 };
92 
93 class AntiAirUnit : public DefenseUnit {
94 private:
95 
96 public:
97  AntiAirUnit(AI *ai);
98  AntiAirUnit(DefenseUnit *inUnit, AI *ai);
99  int getType() const override { return DUT_ANTI_AIR; }
100  Common::Point *createTargetPos(int index, int distance, int weaponType, int sourceX, int sourceY) override;
101  int selectWeapon(int index) override;
102 };
103 
104 class ShieldUnit : public DefenseUnit {
105 private:
106 
107 public:
108  ShieldUnit(AI *ai);
109  ShieldUnit(DefenseUnit *inUnit, AI *ai);
110  int getType() const override { return DUT_SHIELD; }
111  Common::Point *createTargetPos(int index, int distance, int weaponType, int sourceX, int sourceY) override;
112  int selectWeapon(int index) override;
113 };
114 
115 class MineUnit : public DefenseUnit {
116 private:
117 
118 public:
119  MineUnit(AI *ai);
120  MineUnit(DefenseUnit *inUnit, AI *ai);
121  int getType() const override { return DUT_MINE; }
122  Common::Point *createTargetPos(int index, int distance, int weaponType, int sourceX, int sourceY) override;
123  int selectWeapon(int index) override;
124 };
125 
126 class HubUnit : public DefenseUnit {
127 private:
128 
129 public:
130  HubUnit(AI *ai);
131  HubUnit(DefenseUnit *inUnit, AI *ai);
132  int getType() const override { return DUT_HUB; }
133  Common::Point *createTargetPos(int index, int distance, int weaponType, int sourceX, int sourceY) override;
134  int selectWeapon(int index) override;
135 };
136 
137 class TowerUnit : public DefenseUnit {
138 private:
139 
140 public:
141  TowerUnit(AI *ai);
142  TowerUnit(DefenseUnit *inUnit, AI *ai);
143  int getType() const override { return DUT_TOWER; }
144  Common::Point *createTargetPos(int index, int distance, int weaponType, int sourceX, int sourceY) override;
145  int selectWeapon(int index) override;
146 };
147 
148 class BridgeUnit : public DefenseUnit {
149 private:
150 
151 public:
152  BridgeUnit(AI *ai);
153  BridgeUnit(DefenseUnit *inUnit, AI *ai);
154  int getType() const override { return DUT_BRIDGE; }
155  Common::Point *createTargetPos(int index, int distance, int weaponType, int sourceX, int sourceY) override;
156  int selectWeapon(int index) override;
157 };
158 
159 class EnergyUnit : public DefenseUnit {
160 private:
161 
162 public:
163  EnergyUnit(AI *ai);
164  EnergyUnit(DefenseUnit *inUnit, AI *ai);
165  int getType() const override { return DUT_ENERGY; }
166  Common::Point *createTargetPos(int index, int distance, int weaponType, int sourceX, int sourceY) override;
167  int selectWeapon(int index) override;
168 };
169 
170 class OffenseUnit : public DefenseUnit {
171 private:
172 
173 public:
174  OffenseUnit(AI *ai);
175  OffenseUnit(DefenseUnit *inUnit, AI *ai);
176  int getType() const override { return DUT_OFFENSE; }
177  Common::Point *createTargetPos(int index, int distance, int weaponType, int sourceX, int sourceY) override;
178  int selectWeapon(int index) override;
179 };
180 
181 class CrawlerUnit : public DefenseUnit {
182 private:
183 
184 public:
185  CrawlerUnit(AI *ai);
186  CrawlerUnit(DefenseUnit *inUnit, AI *ai);
187  int getType() const override { return DUT_CRAWLER; }
188  Common::Point *createTargetPos(int index, int distance, int weaponType, int sourceX, int sourceY) override;
189  int selectWeapon(int index) override;
190 };
191 
192 } // End of namespace Scumm
193 
194 #endif
Definition: ai_defenseunit.h:93
Definition: ai_defenseunit.h:148
Definition: ai_main.h:85
Definition: ai_defenseunit.h:159
Definition: ai_defenseunit.h:47
Definition: ai_defenseunit.h:181
Definition: rect.h:45
Definition: ai_defenseunit.h:126
int16 x
Definition: rect.h:46
int16 y
Definition: rect.h:47
Definition: ai_defenseunit.h:115
Definition: ai_defenseunit.h:104
Definition: ai_defenseunit.h:137
Definition: actor.h:30
Definition: ai_defenseunit.h:170