132
132
static Army* createNonUniqueArmy(const ArmyProto& a, Player *p=NULL);
133
133
static Army* createNonUniqueArmy(const ArmyProdBase& a, Player *p=NULL);
137
138
//! Set the Id of Armyset and type that this Army belongs to.
138
139
void setArmyset(guint32 armyset, guint32 type);
141
//! Change the armyset that the army type for this army belongs to.
142
void setArmyset(guint32 armyset_id) {d_armyset = armyset_id;};
140
144
//! Set an Army statistic.
141
145
void setStat(Stat stat, guint32 value);
143
147
//! Set the current number of hitpoints of this army.
144
148
void setHP(guint32 hp) {d_hp = hp;}
147
* When you select a stack on the map, you can toggle the armies
148
* which will be moved when you click somewhere else on the map.
149
* Grouped==true means that this army will be among the selected
152
//!Set the grouped state of this Army.
153
void setGrouped(bool grouped){d_grouped = grouped;}
155
150
//! Sets whether or not the Army has a particular medal.
156
151
void setMedalBonus(guint32 index, bool value)
157
152
{d_medal_bonus[index]=value;}
208
204
//! Get the current level of the Army.
209
205
guint32 getLevel() const {return d_level;}
211
//! Returns the grouped state of the Army within a Stack.
212
bool isGrouped() const {return d_grouped;}
214
207
//! Return which medals this Army unit has.
215
208
bool* getMedalBonuses() const {return (bool*)&d_medal_bonus;}
227
220
double getNumberHasBeenHit() const {return d_number_hasbeenhit;}
229
222
//! Return whether or not the Army is in a tower.
230
bool getFortified ();
232
//! Returns how many experience points the next level requires.
233
guint32 getXpNeededForNextLevel() const;
223
bool getFortified () const;
225
//! Is this army a hero?
227
* isHero is overridden by the Hero class.
229
virtual bool isHero() const {return false;};
231
//! This army is of an army type that can be awarded as a reward.
232
bool getAwardable() const;
234
//! This army is of an army type that can be the keeper in a ruin.
235
bool getDefendsRuins() const;
237
//! This army is of an army type that has this name.
238
virtual std::string getName() const;
240
//Methods that operate on class data and modify the class data
236
242
* Regenerate an amount of the Army unit's hitpoints but not
237
243
* exceeding the maximum number of hitpoints.
283
289
//! Increases the experience points of the Army by the given amount.
284
290
void gainXp(double n);
286
//! Checks whether or not the Army unit can advance a level.
287
bool canGainLevel() const;
290
* Increase the Army unit's level, and increase one of three stats;
291
* Stat::STRENGTH, Stat::MOVES, or Stat::SIGHT.
293
* @param stat The stat to increase.
295
* @return How much the statistic increases or -1 upon error
296
* (e.g. because the XP is not enough).
298
//! Increase the Army's level, and increase a given stat.
299
int gainLevel(Stat stat);
302
* Calculate how much a stat is increased because the Army unit
303
* has increased it's level.
305
* @param stat One of Stat::STRENGTH, Stat::MOVES, or Stat::SIGHT.
307
* @return The new value of the stat after it is increased.
309
//! Return how much the stat would be boosted by gaining a level.
310
int computeLevelGain(Stat stat);
292
//! Make this army look and behave like another one.
293
void morph(const ArmyProto *armyproto);
295
//Methods that operate on class data and do not modify the class data
312
297
//! Returns whether or not the army was blessed at the given temple.
313
bool blessedAtTemple(guint32 temple_id);
298
bool blessedAtTemple(guint32 temple_id) const;
315
300
void printAllDebugInfo() const;
317
302
//! Saves the Army to an opened saved-game file.
318
303
virtual bool save(XML_Helper* helper) const;
321
308
* @note This signal is static because sometimes the army doesn't
326
313
//! Emitted when an Army has died.
327
314
static sigc::signal<void, Army*> sdying;
329
virtual bool isHero() const {return false;};
331
//take these values from the army type that the instance points to.
332
bool getAwardable() const;
333
bool getDefendsRuins() const;
334
virtual std::string getName() const;
338
318
//! Generic method for saving Army data. Useful to the Hero class.
442
//! Whether or not the Army unit is grouped into it's parent Stack.
444
* When splitting stacks, it is necessary to know which Army units
445
* are staying in the original Stack, and which ones are going into
448
* If an Army is grouped, it is going into the new Stack.
450
* When attacking, only the grouped Army units in the Stack attack.
455
423
* There are three different medals that an Army unit can win.