~ubuntu-branches/ubuntu/maverick/lordsawar/maverick

« back to all changes in this revision

Viewing changes to src/army.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2010-04-10 09:29:33 UTC
  • mfrom: (1.1.9 upstream) (5.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100410092933-23uq4dxig30kmtcw
Tags: 0.1.8-1
* New upstream release.
* Add misc:Depends for -data package.
* Bump Standards Version to 3.8.4. (No changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
        static Army* createNonUniqueArmy(const ArmyProto& a, Player *p=NULL);
133
133
        static Army* createNonUniqueArmy(const ArmyProdBase& a, Player *p=NULL);
134
134
 
135
 
        // Set functions:
 
135
 
 
136
        // Set Methods
136
137
        
137
138
        //! Set the Id of Armyset and type that this Army belongs to.
138
139
        void setArmyset(guint32 armyset, guint32 type);
 
140
        
 
141
        //! Change the armyset that the army type for this army belongs to.
 
142
        void setArmyset(guint32 armyset_id) {d_armyset = armyset_id;};
139
143
 
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;}
145
149
 
146
 
        /** 
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
150
 
         * armies.
151
 
         */
152
 
        //!Set the grouped state of this Army.
153
 
        void setGrouped(bool grouped){d_grouped = grouped;}
154
 
 
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;}
171
166
        //! Sets whether or not this Army unit is in a tower.
172
167
        void setFortified (bool f);
173
168
 
174
 
        // Get functions
 
169
 
 
170
        // Get Methods 
175
171
        
176
172
        //! Get the Id of the Armyset to which the Army's type belongs.
177
173
        guint32 getArmyset() const {return d_armyset;}
208
204
        //! Get the current level of the Army.
209
205
        guint32 getLevel() const {return d_level;}
210
206
 
211
 
        //! Returns the grouped state of the Army within a Stack.
212
 
        bool isGrouped() const {return d_grouped;}
213
 
 
214
207
        //! Return which medals this Army unit has.
215
208
        bool* getMedalBonuses() const {return (bool*)&d_medal_bonus;}
216
209
 
227
220
        double getNumberHasBeenHit() const {return d_number_hasbeenhit;}
228
221
 
229
222
        //! Return whether or not the Army is in a tower.
230
 
        bool getFortified ();
231
 
 
232
 
        //! Returns how many experience points the next level requires.
233
 
        guint32 getXpNeededForNextLevel() const;
234
 
 
 
223
        bool getFortified () const;
 
224
 
 
225
        //! Is this army a hero?
 
226
        /**
 
227
         * isHero is overridden by the Hero class.
 
228
         */
 
229
        virtual bool isHero() const {return false;};
 
230
 
 
231
        //! This army is of an army type that can be awarded as a reward.
 
232
        bool getAwardable() const;
 
233
 
 
234
        //! This army is of an army type that can be the keeper in a ruin.
 
235
        bool getDefendsRuins() const;
 
236
 
 
237
        //! This army is of an army type that has this name.
 
238
        virtual std::string getName() const;
 
239
 
 
240
        //Methods that operate on class data and modify the class data
235
241
        /** 
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);
285
291
 
286
 
        //! Checks whether or not the Army unit can advance a level.
287
 
        bool canGainLevel() const;
288
 
 
289
 
        /** 
290
 
         * Increase the Army unit's level, and increase one of three stats;
291
 
         * Stat::STRENGTH, Stat::MOVES, or Stat::SIGHT.
292
 
         *
293
 
         * @param stat     The stat to increase.
294
 
         *
295
 
         * @return How much the statistic increases or -1 upon error 
296
 
         *         (e.g. because the XP is not enough).
297
 
         */
298
 
        //! Increase the Army's level, and increase a given stat.
299
 
        int gainLevel(Stat stat);
300
 
 
301
 
        /**
302
 
         * Calculate how much a stat is increased because the Army unit
303
 
         * has increased it's level.
304
 
         *
305
 
         * @param stat  One of Stat::STRENGTH, Stat::MOVES, or Stat::SIGHT.
306
 
         *
307
 
         * @return The new value of the stat after it is increased.
308
 
         */
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);
 
294
 
 
295
        //Methods that operate on class data and do not modify the class data
311
296
 
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;
314
299
 
315
300
        void printAllDebugInfo() const;
316
301
 
317
302
        //! Saves the Army to an opened saved-game file.
318
303
        virtual bool save(XML_Helper* helper) const;
 
304
 
 
305
        //signals
319
306
        
320
307
        /**
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;
328
315
 
329
 
        virtual bool isHero() const {return false;};
330
 
 
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;
335
 
 
336
316
    protected:
337
317
 
338
318
        //! Generic method for saving Army data.  Useful to the Hero class.
439
419
         */
440
420
        guint32 d_level;
441
421
 
442
 
        //! Whether or not the Army unit is grouped into it's parent Stack.
443
 
        /**
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
446
 
         * the new Stack.
447
 
         *
448
 
         * If an Army is grouped, it is going into the new Stack.
449
 
         *
450
 
         * When attacking, only the grouped Army units in the Stack attack.
451
 
         */
452
 
        bool d_grouped;
453
 
 
454
422
        /**
455
423
         * There are three different medals that an Army unit can win.
456
424
         *