GameConstants.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. #pragma once
  2. /*
  3. * GameConstants.h, part of VCMI engine
  4. *
  5. * Authors: listed in file AUTHORS in main folder
  6. *
  7. * License: GNU General Public License v2.0 or later
  8. * Full text of license available in license.txt file, in main folder
  9. *
  10. */
  11. namespace GameConstants
  12. {
  13. const std::string VCMI_VERSION = "VCMI 0.89b";
  14. /*
  15. * DATA_DIR contains the game data (Data/, MP3/, ...).
  16. * BIN_DIR is where the vcmiclient/vcmiserver binaries reside
  17. * LIB_DIR is where the AI libraries reside (linux only)
  18. */
  19. #ifdef _WIN32
  20. const std::string DATA_DIR = ".";
  21. const std::string BIN_DIR = ".";
  22. const std::string LIB_DIR = ".";
  23. const std::string SERVER_NAME = "VCMI_server.exe";
  24. const std::string LIB_EXT = "dll";
  25. const std::string PATH_SEPARATOR = "\\";
  26. #else
  27. #ifndef M_DATA_DIR
  28. #error M_DATA_DIR undefined.
  29. #else
  30. const std::string DATA_DIR = M_DATA_DIR;
  31. #endif
  32. #ifndef M_BIN_DIR
  33. #error M_BIN_DIR undefined.
  34. #else
  35. const std::string BIN_DIR = M_BIN_DIR;
  36. #endif
  37. #ifndef M_LIB_DIR
  38. #error M_LIB_DIR undefined.
  39. #else
  40. const std::string LIB_DIR = M_LIB_DIR;
  41. #endif
  42. const std::string SERVER_NAME = "vcmiserver";
  43. const std::string LIB_EXT = "so";
  44. const std::string PATH_SEPARATOR = "/";
  45. #endif
  46. const int BFIELD_WIDTH = 17;
  47. const int BFIELD_HEIGHT = 11;
  48. const int BFIELD_SIZE = BFIELD_WIDTH * BFIELD_HEIGHT;
  49. const int ARMY_SIZE = 7;
  50. const int BOATI_TYPE = 8;
  51. const int HEROI_TYPE = 34;
  52. const int TOWNI_TYPE = 98;
  53. const int SUBTERRANEAN_GATE_TYPE = 103;
  54. const int CREI_TYPE = 54;
  55. const int EVENTI_TYPE = 26;
  56. const int CREATURES_COUNT = 197;
  57. const int CRE_LEVELS = 10;
  58. const int F_NUMBER = 9; //factions (town types) quantity
  59. const int PLAYER_LIMIT = 8; //player limit per map
  60. const int MAX_HEROES_PER_PLAYER = 8;
  61. const int ALL_PLAYERS = 255; //bitfield
  62. const int HEROES_PER_TYPE=8; //amount of heroes of each type
  63. const int SKILL_QUANTITY=28;
  64. const int SKILL_PER_HERO=8;
  65. const int ARTIFACTS_QUANTITY=171;
  66. const int HEROES_QUANTITY=156;
  67. const int SPELLS_QUANTITY=70;
  68. const int PRIMARY_SKILLS=4;
  69. const int NEUTRAL_PLAYER=255;
  70. const int NAMES_PER_TOWN=16;
  71. const int CREATURES_PER_TOWN = 7; //without upgrades
  72. const int SPELL_LEVELS = 5;
  73. const int AVAILABLE_HEROES_PER_PLAYER = 2;
  74. const int SPELLBOOK_GOLD_COST = 500;
  75. const ui16 BACKPACK_START = 19;
  76. const int ID_CATAPULT = 3, ID_LOCK = 145;
  77. const int TERRAIN_TYPES=10;
  78. const std::string TERRAIN_NAMES [TERRAIN_TYPES] = {
  79. "dirt", "sand", "grass", "snow", "swamp", "rough", "subterra", "lava", "water", "rock"
  80. };
  81. const int RESOURCE_QUANTITY=8;
  82. const std::string RESOURCE_NAMES [RESOURCE_QUANTITY] = {
  83. "wood", "mercury", "ore", "sulfur", "crystal", "gems", "gold", "mithril"
  84. };
  85. }
  86. // Enum declarations
  87. namespace PrimarySkill
  88. {
  89. enum { ATTACK, DEFENSE, SPELL_POWER, KNOWLEDGE};
  90. }
  91. namespace EVictoryConditionType
  92. {
  93. enum EVictoryConditionType { ARTIFACT, GATHERTROOP, GATHERRESOURCE, BUILDCITY, BUILDGRAIL, BEATHERO,
  94. CAPTURECITY, BEATMONSTER, TAKEDWELLINGS, TAKEMINES, TRANSPORTITEM, WINSTANDARD = 255 };
  95. }
  96. namespace ELossConditionType
  97. {
  98. enum ELossConditionType { LOSSCASTLE, LOSSHERO, TIMEEXPIRES, LOSSSTANDARD = 255 };
  99. }
  100. namespace EAlignment
  101. {
  102. enum EAlignment { GOOD, EVIL, NEUTRAL };
  103. }
  104. namespace ETownType
  105. {
  106. enum ETownType
  107. {
  108. ANY = -1,
  109. CASTLE, RAMPART, TOWER, INFERNO, NECROPOLIS, DUNGEON, STRONGHOLD, FORTRESS, CONFLUX
  110. };
  111. }
  112. namespace EBuilding
  113. {
  114. //Quite useful as long as most of building mechanics hardcoded
  115. // NOTE: all building with completely configurable mechanics will be removed from list
  116. enum EBuilding
  117. {
  118. MAGES_GUILD_1, MAGES_GUILD_2, MAGES_GUILD_3, MAGES_GUILD_4, MAGES_GUILD_5,
  119. TAVERN, SHIPYARD, FORT, CITADEL, CASTLE,
  120. VILLAGE_HALL, TOWN_HALL, CITY_HALL, CAPITOL, MARKETPLACE,
  121. RESOURCE_SILO, BLACKSMITH, SPECIAL_1, HORDE_1, HORDE_1_UPGR,
  122. SHIP, SPECIAL_2, SPECIAL_3, SPECIAL_4, HORDE_2,
  123. HORDE_2_UPGR, GRAIL, EXTRA_TOWN_HALL, EXTRA_CITY_HALL, EXTRA_CAPITOL,
  124. DWELL_FIRST=30, DWELL_LAST=36, DWELL_UP_FIRST=37, DWELL_UP_LAST=43,
  125. //Special buildings for towns.
  126. LIGHTHOUSE = SPECIAL_1,
  127. STABLES = SPECIAL_2, //Castle
  128. BROTHERHOOD = SPECIAL_3,
  129. MYSTIC_POND = SPECIAL_1,
  130. FOUNTAIN_OF_FORTUNE = SPECIAL_3, //Rampart
  131. TREASURY = SPECIAL_4,
  132. ARTIFACT_MERCHANT = SPECIAL_1,
  133. LOOKOUT_TOWER = SPECIAL_2, //Tower
  134. LIBRARY = SPECIAL_3,
  135. WALL_OF_KNOWLEDGE = SPECIAL_4,
  136. STORMCLOUDS = SPECIAL_2,
  137. CASTLE_GATE = SPECIAL_3, //Inferno
  138. ORDER_OF_FIRE = SPECIAL_4,
  139. COVER_OF_DARKNESS = SPECIAL_1,
  140. NECROMANCY_AMPLIFIER = SPECIAL_2, //Necropolis
  141. SKELETON_TRANSFORMER = SPECIAL_3,
  142. //ARTIFACT_MERCHANT - same ID as in tower
  143. MANA_VORTEX = SPECIAL_2,
  144. PORTAL_OF_SUMMON = SPECIAL_3, //Dungeon
  145. BATTLE_ACADEMY = SPECIAL_4,
  146. ESCAPE_TUNNEL = SPECIAL_1,
  147. FREELANCERS_GUILD = SPECIAL_2, //Stronghold
  148. BALLISTA_YARD = SPECIAL_3,
  149. HALL_OF_VALHALLA = SPECIAL_4,
  150. CAGE_OF_WARLORDS = SPECIAL_1,
  151. GLYPHS_OF_FEAR = SPECIAL_2, // Fortress
  152. BLOOD_OBELISK = SPECIAL_3,
  153. //ARTIFACT_MERCHANT - same ID as in tower
  154. MAGIC_UNIVERSITY = SPECIAL_2, // Conflux
  155. };
  156. }
  157. namespace EBuildingState
  158. {
  159. enum EBuildingState
  160. {
  161. HAVE_CAPITAL, NO_WATER, FORBIDDEN, ADD_MAGES_GUILD, ALREADY_PRESENT, CANT_BUILD_TODAY,
  162. NO_RESOURCES, ALLOWED, PREREQUIRES, BUILDING_ERROR
  163. };
  164. }
  165. namespace ESpellCastProblem
  166. {
  167. enum ESpellCastProblem
  168. {
  169. OK, NO_HERO_TO_CAST_SPELL, ALREADY_CASTED_THIS_TURN, NO_SPELLBOOK, ANOTHER_ELEMENTAL_SUMMONED,
  170. HERO_DOESNT_KNOW_SPELL, NOT_ENOUGH_MANA, ADVMAP_SPELL_INSTEAD_OF_BATTLE_SPELL,
  171. SECOND_HEROS_SPELL_IMMUNITY, SPELL_LEVEL_LIMIT_EXCEEDED, NO_SPELLS_TO_DISPEL,
  172. NO_APPROPRIATE_TARGET, STACK_IMMUNE_TO_SPELL, WRONG_SPELL_TARGET, ONGOING_TACTIC_PHASE,
  173. MAGIC_IS_BLOCKED, //For Orb of Inhibition and similar - no casting at all
  174. INVALID
  175. };
  176. }
  177. namespace ECastingMode
  178. {
  179. enum ECastingMode {HERO_CASTING, AFTER_ATTACK_CASTING, //also includes cast before attack
  180. MAGIC_MIRROR, CREATURE_ACTIVE_CASTING, ENCHANTER_CASTING};
  181. }
  182. namespace EMarketMode
  183. {
  184. enum EMarketMode
  185. {
  186. RESOURCE_RESOURCE, RESOURCE_PLAYER, CREATURE_RESOURCE, RESOURCE_ARTIFACT,
  187. ARTIFACT_RESOURCE, ARTIFACT_EXP, CREATURE_EXP, CREATURE_UNDEAD, RESOURCE_SKILL,
  188. MARTKET_AFTER_LAST_PLACEHOLDER
  189. };
  190. }
  191. namespace EBattleStackState
  192. {
  193. enum EBattleStackState{ALIVE = 180, SUMMONED, CLONED, HAD_MORALE, WAITING, MOVED, DEFENDING, FEAR,
  194. DRAINED_MANA /*remember to drain mana only once per turn*/};
  195. }
  196. namespace ECommander
  197. {
  198. enum SecondarySkills {ATTACK, DEFENSE, HEALTH, DAMAGE, SPEED, SPELL_POWER, CASTS, RESISTANCE};
  199. const int MAX_SKILL_LEVEL = 5;
  200. }
  201. namespace EWallParts
  202. {
  203. enum EWallParts
  204. {
  205. INDESTRUCTIBLE_PART = -2, INVALID = -1,
  206. KEEP = 0, BOTTOM_TOWER, BOTTOM_WALL, BELOW_GATE, OVER_GATE, UPPER_WAL, UPPER_TOWER, GATE,
  207. PARTS_COUNT
  208. };
  209. }
  210. namespace EWallState
  211. {
  212. enum
  213. {
  214. NONE, //no wall
  215. INTACT,
  216. DAMAGED,
  217. DESTROYED
  218. };
  219. }
  220. namespace Obj
  221. {
  222. enum
  223. {
  224. ARTIFACT = 5,
  225. BOAT = 8,
  226. BORDERGUARD = 9,
  227. KEYMASTER = 10,
  228. CREATURE_BANK = 16,
  229. CREATURE_GENERATOR1 = 17,
  230. CURSED_GROUND1 = 21,
  231. DERELICT_SHIP = 24,
  232. DRAGON_UTOPIA = 25,
  233. GARRISON = 33,
  234. HILL_FORT = 35,
  235. LIBRARY_OF_ENLIGHTENMENT = 41,
  236. MONOLITH1 = 43,
  237. MONOLITH2 = 44,
  238. MONOLITH3 = 45,
  239. MAGIC_PLAINS1 = 46,
  240. SCHOOL_OF_MAGIC = 47,
  241. MAGIC_WELL = 49,
  242. MINE = 53,
  243. MONSTER = 54,
  244. OBELISK = 57,
  245. PRISON = 62,
  246. PYRAMID = 63,
  247. SEER_HUT = 83,
  248. CRYPT = 84,
  249. SHIPWRECK = 85,
  250. STABLES = 94,
  251. TRADING_POST = 99,
  252. TREE_OF_KNOWLEDGE = 102,
  253. SUBTERRANEAN_GATE = 103,
  254. UNIVERSITY = 104,
  255. SCHOOL_OF_WAR = 107,
  256. WHIRLPOOL = 111,
  257. BORDER_GATE = 212,
  258. QUEST_GUARD = 215,
  259. GARRISON2 = 219,
  260. ABANDONED_MINE = 220,
  261. CLOVER_FIELD = 222,
  262. CURSED_GROUND2 = 223,
  263. EVIL_FOG = 224,
  264. FAVORABLE_WINDS = 225,
  265. FIERY_FIELDS = 226,
  266. HOLY_GROUNDS = 227,
  267. LUCID_POOLS = 228,
  268. MAGIC_CLOUDS = 229,
  269. MAGIC_PLAINS2 = 230,
  270. ROCKLANDS = 231,
  271. };
  272. }
  273. namespace SecSkillLevel
  274. {
  275. enum SecSkillLevel
  276. {
  277. NONE,
  278. BASIC,
  279. ADVANCED,
  280. EXPERT
  281. };
  282. }
  283. //follows ERM BI (battle image) format
  284. namespace BattlefieldBI
  285. {
  286. enum
  287. {
  288. NONE = -1,
  289. COASTAL,
  290. //Discrepency from ERM BI description - we have magic plains and cursed gronds swapped
  291. MAGIC_PLAINS,
  292. CURSED_GROUND,
  293. //
  294. HOLY_GROUND,
  295. EVIL_FOG,
  296. CLOVER_FIELD,
  297. LUCID_POOLS,
  298. FIERY_FIELDS,
  299. ROCKLANDS,
  300. MAGIC_CLOUDS,
  301. };
  302. }
  303. // Typedef declarations
  304. typedef si64 expType;
  305. typedef ui32 TSpell;
  306. typedef std::pair<ui32, ui32> TDmgRange;
  307. typedef ui8 TBonusType;
  308. typedef si32 TBonusSubtype;
  309. typedef si32 TSlot;
  310. typedef si32 TQuantity;
  311. typedef ui32 TCreature; //creature id