1
// Copyright (C) 2000, 2001, 2003 Michael Bartl
2
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Ulf Lorenz
3
// Copyright (C) 2004, 2005 Andrea Paternesi
4
// Copyright (C) 2007, 2008 Ben Asselstine
5
// Copyright (C) 2007, 2008 Ole Laursen
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 2 of the License, or
10
// (at your option) any later version.
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 Library General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with this program; if not, write to the Free Software
19
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
35
//! The bitwise OR-able special bonus that the Army gives.
37
//! Provides +1 strength to the Army when positioned in the open.
38
ADD1STRINOPEN = 0x00000001,
39
//! Provides +2 strength to the Army when positioned in the open.
40
ADD2STRINOPEN = 0x00000002,
41
//! Provides +1 strength to the Army when positioned in the forest.
42
ADD1STRINFOREST = 0x00000004,
43
//! Provides +1 strength to the Army when positioned in the hills.
44
ADD1STRINHILLS = 0x00000008,
45
//! Provides +1 strength to the Army when positioned in a City.
46
ADD1STRINCITY = 0x00000010,
47
//! Provides +2 strength to the Army when positioned in a City.
48
ADD2STRINCITY = 0x00000020,
49
//! Provides +1 strength to the Stack when positioned in the hills.
50
ADD1STACKINHILLS = 0x00000040,
51
//! Negate any City bonuses from an enemy Stack during a Fight.
52
SUBALLCITYBONUS = 0x00000080,
53
//! Negates 1 strength point from an enemy Stack during a Fight.
54
SUB1ENEMYSTACK = 0x00000100,
55
//! Provides +1 strength to all Army units in the Stack.
56
ADD1STACK = 0x00000200,
57
//! Provides +2 strength to all Army units in the Stack.
58
ADD2STACK = 0x00000400,
59
//! Negate all non-Hero bonuses in an enemy Stack during a Fight.
60
SUBALLNONHEROBONUS = 0x00000800,
61
//! Negate all Hero bonuses in an enemy Stack during a Fight.
62
SUBALLHEROBONUS = 0x00001000, //0 enemy hero bonus
63
//! Provides a +1 strength to all Army units in a fortified Stack.
66
static Uint32 bonusFlagsFromString(const std::string str);
67
static std::string bonusFlagsToString(const Uint32 bonus);
68
static ArmyBase::Bonus bonusFlagFromString(const std::string str);
69
static std::string bonusFlagToString(const ArmyBase::Bonus bonus);
71
//! Various kinds of statistics that an instance of Army unit has.
73
* This enumeration assists in getting and setting of statistics in
74
* an instance of an Army unit.
77
//! How strong the Army unit is in battle.
79
//! The maximum number of hitpoints that the Army unit can have.
81
//! The maximum number of moves the Army unit has.
83
//! The various Tile::Type that the Army moves efficiently in.
85
//! The special bonus the Army has (Army::Bonus).
87
//! How far the Army unit can see on a hidden map.
89
//! If the Army unit is in a boat or not.
91
//! If the Army unit is having it's movement doubled/tripled or not.
95
static Uint32 moveFlagsFromString(const std::string str);
96
static std::string moveFlagsToString(const Uint32 move_bonus);
99
ArmyBase(const ArmyBase& army);
101
//! Loading constructor.
102
ArmyBase(XML_Helper* helper);
104
//! Create an empty army base.
112
//! Set how much gold this unit requires per turn.
113
void setUpkeep(Uint32 upkeep){d_upkeep = upkeep;}
115
//! Set the strength of the army.
116
void setStrength(Uint32 strength) {d_strength = strength;}
120
//! Returns how many gold pieces this Army needs per turn.
121
Uint32 getUpkeep() const {return d_upkeep;}
124
//! Get the army bonus of the army.
125
Uint32 getArmyBonus() const {return d_army_bonus;}
127
//! Get the move bonus.
129
* Get which kinds of terrain tiles this Army moves efficiently
132
* @return A bitwise OR-ing of the values in Tile::Type.
134
Uint32 getMoveBonus() const {return d_move_bonus;}
136
//! Get the move bonus of the army.
137
Uint32 getMaxMoves() const {return d_max_moves;}
139
//! Get the strength of the army.
140
Uint32 getStrength() const {return d_strength;}
142
//! Get the distance this army can see on a hidden map.
143
Uint32 getSight() const {return d_sight;}
145
std::string getArmyBonusDescription() const;
147
//! Set how much XP this unit is worth when killed.
148
void setXpReward(double xp_value){d_xp_value = xp_value;}
150
//! Returns the number of XP that killing this Army garners it's killer.
151
double getXpReward() const {return d_xp_value;}
154
//! Generic method for saving Army base data.
155
bool saveData(XML_Helper* helper) const;
157
//! The amount it costs to maintain this Army unit for this turn.
159
* @note The amount is in gold pieces.
161
* This value does not change during gameplay.
163
* @note Some special units have an upkeep of 0, but usually this
164
* value is more than zero.
169
* The strength of the Army unit is the prime factor when
170
* calculating the outcome of a Fight. This value should always
171
* be 1 or more, but not exceeding 15.
173
* This value can permanently increase when the Army unit increases
176
* Temporary increases due to the Army unit being on a certain kind
177
* of terrain, or because another Army unit has conferred strength
178
* on it (see Army::Bonus) are not reflected in d_strength.
180
* This value does not decrease during gameplay.
182
//! The base strength of the Army unit.
185
//! The maximum number of movement points that this Army unit has.
187
* This value must always be above 1. Sane values are above 7.
189
* This value can be permanently increased when the Army unit
190
* increases it's level.
192
* This value does not decrease during gameplay.
194
* @note When an Army unit is having it's movement doubled, or even
195
* tripled due to a Hero carrying an Item, this value does not
196
* reflect that doubling or tripling.
200
//! How far the Army unit can see on a hidden map.
202
* When a stack is moving on a hidden map, a certain number of
203
* tiles get illuminated or unshaded. d_sight is the radius of
204
* tiles that this Army unit can illuminate.
206
* This value can be permanently increased when the Army unit
207
* increases it's level.
209
* This value does not decrease during gameplay.
213
//! The movement bonus of the Army unit.
215
* d_move_bonus represents the terrain tiles that the Army unit
216
* can travel efficiently over. Traveling efficiently entails
217
* that it only costs 2 movement points to travel over that kind
218
* of terrain, no matter what the actual terrain movement value is.
220
* The movement bonus is a bitwise OR-ing of the values in
223
* When each of the members of Tile::Type are included in the
224
* d_move_bonus value, the Army unit is flying.
226
* This value does not change during gameplay.
231
* d_army_bonus represents the special abilities this Army unit has.
232
* The special abilities are enumerated in Army::Bonus.
234
* The army bonus is a bitwise OR-ing of the values in Army::Bonus.
236
* This value does not change during gameplay.
238
//! The special capbilities of the Army unit.
241
//! The amount of XP this Army unit worth when killed by an assailant.
243
* When this Army unit is killed, d_xp_value is added to the killer's
246
* This value must be over 0.
248
* This value does not change during gameplay.
256
#endif // ARMY_BASE_H