GameConstants.h 9.0 KB

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