ISpellMechanics.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. /*
  2. * ISpellMechanics.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "ISpellMechanics.h"
  12. #include "../CRandomGenerator.h"
  13. #include "../VCMI_Lib.h"
  14. #include "../bonuses/Bonus.h"
  15. #include "../battle/CBattleInfoCallback.h"
  16. #include "../battle/IBattleState.h"
  17. #include "../battle/Unit.h"
  18. #include "../mapObjects/CGHeroInstance.h"
  19. #include "../serializer/JsonDeserializer.h"
  20. #include "../serializer/JsonSerializer.h"
  21. #include "TargetCondition.h"
  22. #include "Problem.h"
  23. #include "AdventureSpellMechanics.h"
  24. #include "BattleSpellMechanics.h"
  25. #include "effects/Effects.h"
  26. #include "effects/Registry.h"
  27. #include "effects/Damage.h"
  28. #include "effects/Timed.h"
  29. #include "CSpellHandler.h"
  30. #include "../CHeroHandler.h"//todo: remove
  31. #include "../IGameCallback.h"//todo: remove
  32. #include "../BattleFieldHandler.h"
  33. VCMI_LIB_NAMESPACE_BEGIN
  34. namespace spells
  35. {
  36. static std::shared_ptr<TargetCondition> makeCondition(const CSpell * s)
  37. {
  38. auto res = std::make_shared<TargetCondition>();
  39. JsonDeserializer deser(nullptr, s->targetCondition);
  40. res->serializeJson(deser, TargetConditionItemFactory::getDefault());
  41. return res;
  42. }
  43. class CustomMechanicsFactory : public ISpellMechanicsFactory
  44. {
  45. public:
  46. std::unique_ptr<Mechanics> create(const IBattleCast * event) const override
  47. {
  48. auto * ret = new BattleSpellMechanics(event, effects, targetCondition);
  49. return std::unique_ptr<Mechanics>(ret);
  50. }
  51. protected:
  52. std::shared_ptr<effects::Effects> effects;
  53. CustomMechanicsFactory(const CSpell * s)
  54. : ISpellMechanicsFactory(s), effects(new effects::Effects)
  55. {
  56. targetCondition = makeCondition(s);
  57. }
  58. void loadEffects(const JsonNode & config, const int level)
  59. {
  60. JsonDeserializer deser(nullptr, config);
  61. effects->serializeJson(VLC->spellEffects(), deser, level);
  62. }
  63. private:
  64. std::shared_ptr<IReceptiveCheck> targetCondition;
  65. };
  66. class ConfigurableMechanicsFactory : public CustomMechanicsFactory
  67. {
  68. public:
  69. ConfigurableMechanicsFactory(const CSpell * s)
  70. : CustomMechanicsFactory(s)
  71. {
  72. for(int level = 0; level < GameConstants::SPELL_SCHOOL_LEVELS; level++)
  73. loadEffects(s->getLevelInfo(level).battleEffects, level);
  74. }
  75. };
  76. //to be used for spells configured with old format
  77. class FallbackMechanicsFactory : public CustomMechanicsFactory
  78. {
  79. public:
  80. FallbackMechanicsFactory(const CSpell * s)
  81. : CustomMechanicsFactory(s)
  82. {
  83. for(int level = 0; level < GameConstants::SPELL_SCHOOL_LEVELS; level++)
  84. {
  85. const CSpell::LevelInfo & levelInfo = s->getLevelInfo(level);
  86. assert(levelInfo.battleEffects.isNull());
  87. if(s->isOffensive())
  88. {
  89. //default constructed object should be enough
  90. effects->add("directDamage", std::make_shared<effects::Damage>(), level);
  91. }
  92. std::shared_ptr<effects::Effect> effect;
  93. if(!levelInfo.effects.empty())
  94. {
  95. auto * timed = new effects::Timed();
  96. timed->cumulative = false;
  97. timed->bonus = levelInfo.effects;
  98. effect.reset(timed);
  99. }
  100. if(!levelInfo.cumulativeEffects.empty())
  101. {
  102. auto * timed = new effects::Timed();
  103. timed->cumulative = true;
  104. timed->bonus = levelInfo.cumulativeEffects;
  105. effect.reset(timed);
  106. }
  107. if(effect)
  108. effects->add("timed", effect, level);
  109. }
  110. }
  111. };
  112. BattleCast::BattleCast(const CBattleInfoCallback * cb_, const Caster * caster_, const Mode mode_, const CSpell * spell_):
  113. spell(spell_),
  114. cb(cb_),
  115. caster(caster_),
  116. mode(mode_),
  117. smart(boost::logic::indeterminate),
  118. massive(boost::logic::indeterminate)
  119. {
  120. }
  121. BattleCast::BattleCast(const BattleCast & orig, const Caster * caster_)
  122. : spell(orig.spell),
  123. cb(orig.cb),
  124. caster(caster_),
  125. mode(Mode::MAGIC_MIRROR),
  126. magicSkillLevel(orig.magicSkillLevel),
  127. effectPower(orig.effectPower),
  128. effectDuration(orig.effectDuration),
  129. effectValue(orig.effectValue),
  130. smart(true),
  131. massive(false)
  132. {
  133. }
  134. BattleCast::~BattleCast() = default;
  135. const CSpell * BattleCast::getSpell() const
  136. {
  137. return spell;
  138. }
  139. Mode BattleCast::getMode() const
  140. {
  141. return mode;
  142. }
  143. const Caster * BattleCast::getCaster() const
  144. {
  145. return caster;
  146. }
  147. const CBattleInfoCallback * BattleCast::getBattle() const
  148. {
  149. return cb;
  150. }
  151. BattleCast::OptionalValue BattleCast::getSpellLevel() const
  152. {
  153. return magicSkillLevel;
  154. }
  155. BattleCast::OptionalValue BattleCast::getEffectPower() const
  156. {
  157. return effectPower;
  158. }
  159. BattleCast::OptionalValue BattleCast::getEffectDuration() const
  160. {
  161. return effectDuration;
  162. }
  163. BattleCast::OptionalValue64 BattleCast::getEffectValue() const
  164. {
  165. return effectValue;
  166. }
  167. boost::logic::tribool BattleCast::isSmart() const
  168. {
  169. return smart;
  170. }
  171. boost::logic::tribool BattleCast::isMassive() const
  172. {
  173. return massive;
  174. }
  175. void BattleCast::setSpellLevel(BattleCast::Value value)
  176. {
  177. magicSkillLevel = std::make_optional(value);
  178. }
  179. void BattleCast::setEffectPower(BattleCast::Value value)
  180. {
  181. effectPower = std::make_optional(value);
  182. }
  183. void BattleCast::setEffectDuration(BattleCast::Value value)
  184. {
  185. effectDuration = std::make_optional(value);
  186. }
  187. void BattleCast::setEffectValue(BattleCast::Value64 value)
  188. {
  189. effectValue = std::make_optional(value);
  190. }
  191. void BattleCast::applyEffects(ServerCallback * server, const Target & target, bool indirect, bool ignoreImmunity) const
  192. {
  193. auto m = spell->battleMechanics(this);
  194. m->applyEffects(server, target, indirect, ignoreImmunity);
  195. }
  196. void BattleCast::cast(ServerCallback * server, Target target)
  197. {
  198. if(target.empty())
  199. target.emplace_back();
  200. auto m = spell->battleMechanics(this);
  201. const battle::Unit * mainTarget = nullptr;
  202. if(target.front().unitValue)
  203. {
  204. mainTarget = target.front().unitValue;
  205. }
  206. else if(target.front().hexValue.isValid())
  207. {
  208. mainTarget = cb->battleGetUnitByPos(target.front().hexValue, true);
  209. }
  210. bool tryMagicMirror = (mainTarget != nullptr) && (mode == Mode::HERO || mode == Mode::CREATURE_ACTIVE);//TODO: recheck
  211. tryMagicMirror = tryMagicMirror && (mainTarget->unitOwner() != caster->getCasterOwner()) && !spell->isPositive();//TODO: recheck
  212. m->cast(server, target);
  213. //Magic Mirror effect
  214. if(tryMagicMirror)
  215. {
  216. const std::string magicMirrorCacheStr = "type_MAGIC_MIRROR";
  217. static const auto magicMirrorSelector = Selector::type()(BonusType::MAGIC_MIRROR);
  218. auto rangeGen = server->getRNG()->getInt64Range(0, 99);
  219. const int mirrorChance = mainTarget->valOfBonuses(magicMirrorSelector, magicMirrorCacheStr);
  220. if(rangeGen() < mirrorChance)
  221. {
  222. auto mirrorTargets = cb->battleGetUnitsIf([this](const battle::Unit * unit)
  223. {
  224. //Get all caster stacks. Magic mirror can reflect to immune creature (with no effect)
  225. return unit->unitOwner() == caster->getCasterOwner() && unit->isValidTarget(true);
  226. });
  227. if(!mirrorTargets.empty())
  228. {
  229. const auto * mirrorDestination = (*RandomGeneratorUtil::nextItem(mirrorTargets, *server->getRNG()));
  230. Target mirrorTarget;
  231. mirrorTarget.emplace_back(mirrorDestination);
  232. BattleCast mirror(*this, mainTarget);
  233. mirror.cast(server, mirrorTarget);
  234. }
  235. }
  236. }
  237. }
  238. void BattleCast::castEval(ServerCallback * server, Target target)
  239. {
  240. //TODO: make equivalent to normal cast
  241. if(target.empty())
  242. target.emplace_back();
  243. auto m = spell->battleMechanics(this);
  244. //TODO: reflection
  245. //TODO: random effects evaluation
  246. m->castEval(server, target);
  247. }
  248. bool BattleCast::castIfPossible(ServerCallback * server, Target target)
  249. {
  250. if(spell->canBeCast(cb, mode, caster))
  251. {
  252. cast(server, std::move(target));
  253. return true;
  254. }
  255. return false;
  256. }
  257. std::vector<Target> BattleCast::findPotentialTargets(bool fast) const
  258. {
  259. //TODO: for more than 2 destinations per target much more efficient algorithm is required
  260. auto m = spell->battleMechanics(this);
  261. auto targetTypes = m->getTargetTypes();
  262. if(targetTypes.empty() || targetTypes.size() > 2)
  263. {
  264. return std::vector<Target>();
  265. }
  266. else
  267. {
  268. std::vector<Target> previous;
  269. std::vector<Target> next;
  270. for(size_t index = 0; index < targetTypes.size(); index++)
  271. {
  272. std::swap(previous, next);
  273. next.clear();
  274. std::vector<Destination> destinations;
  275. if(previous.empty())
  276. {
  277. Target empty;
  278. destinations = m->getPossibleDestinations(index, targetTypes.at(index), empty, fast);
  279. for(auto & destination : destinations)
  280. {
  281. Target target;
  282. target.emplace_back(destination);
  283. next.push_back(target);
  284. }
  285. }
  286. else
  287. {
  288. for(const Target & current : previous)
  289. {
  290. destinations = m->getPossibleDestinations(index, targetTypes.at(index), current, fast);
  291. for(auto & destination : destinations)
  292. {
  293. Target target = current;
  294. target.emplace_back(destination);
  295. next.push_back(target);
  296. }
  297. }
  298. }
  299. if(next.empty())
  300. break;
  301. }
  302. return next;
  303. }
  304. }
  305. ///ISpellMechanicsFactory
  306. ISpellMechanicsFactory::ISpellMechanicsFactory(const CSpell * s)
  307. : spell(s)
  308. {
  309. }
  310. //must be instantiated in .cpp file for access to complete types of all member fields
  311. ISpellMechanicsFactory::~ISpellMechanicsFactory() = default;
  312. std::unique_ptr<ISpellMechanicsFactory> ISpellMechanicsFactory::get(const CSpell * s)
  313. {
  314. if(s->hasBattleEffects())
  315. return std::make_unique<ConfigurableMechanicsFactory>(s);
  316. else
  317. return std::make_unique<FallbackMechanicsFactory>(s);
  318. }
  319. ///Mechanics
  320. Mechanics::Mechanics()
  321. : caster(nullptr),
  322. casterSide(0)
  323. {
  324. }
  325. Mechanics::~Mechanics() = default;
  326. BaseMechanics::BaseMechanics(const IBattleCast * event):
  327. owner(event->getSpell()),
  328. mode(event->getMode()),
  329. smart(event->isSmart()),
  330. massive(event->isMassive()),
  331. cb(event->getBattle())
  332. {
  333. caster = event->getCaster();
  334. //FIXME: do not crash on invalid side
  335. casterSide = cb->playerToSide(caster->getCasterOwner()).value();
  336. {
  337. auto value = event->getSpellLevel();
  338. rangeLevel = value.value_or(caster->getSpellSchoolLevel(owner));
  339. vstd::abetween(rangeLevel, 0, 3);
  340. }
  341. {
  342. auto value = event->getSpellLevel();
  343. effectLevel = value.value_or(caster->getEffectLevel(owner));
  344. vstd::abetween(effectLevel, 0, 3);
  345. }
  346. {
  347. auto value = event->getEffectPower();
  348. effectPower = value.value_or(caster->getEffectPower(owner));
  349. vstd::amax(effectPower, 0);
  350. }
  351. {
  352. auto value = event->getEffectDuration();
  353. effectDuration = value.value_or(caster->getEnchantPower(owner));
  354. vstd::amax(effectDuration, 0); //???
  355. }
  356. {
  357. auto value = event->getEffectValue();
  358. auto casterValue = caster->getEffectValue(owner) ? caster->getEffectValue(owner) : owner->calculateRawEffectValue(effectLevel, effectPower, 1);
  359. effectValue = value.value_or(casterValue);
  360. vstd::amax(effectValue, 0);
  361. }
  362. }
  363. BaseMechanics::~BaseMechanics() = default;
  364. bool BaseMechanics::adaptGenericProblem(Problem & target) const
  365. {
  366. MetaString text;
  367. // %s recites the incantations but they seem to have no effect.
  368. text.appendLocalString(EMetaText::GENERAL_TXT, 541);
  369. assert(caster);
  370. caster->getCasterName(text);
  371. target.add(std::move(text), spells::Problem::NORMAL);
  372. return false;
  373. }
  374. bool BaseMechanics::adaptProblem(ESpellCastProblem source, Problem & target) const
  375. {
  376. if(source == ESpellCastProblem::OK)
  377. return true;
  378. switch(source)
  379. {
  380. case ESpellCastProblem::SPELL_LEVEL_LIMIT_EXCEEDED:
  381. {
  382. MetaString text;
  383. //TODO: refactor
  384. const auto * hero = dynamic_cast<const CGHeroInstance *>(caster);
  385. if(!hero)
  386. return adaptGenericProblem(target);
  387. //Recanter's Cloak or similar effect. Try to retrieve bonus
  388. const auto b = hero->getBonusLocalFirst(Selector::type()(BonusType::BLOCK_MAGIC_ABOVE));
  389. //TODO what about other values and non-artifact sources?
  390. if(b && b->val == 2 && b->source == BonusSource::ARTIFACT)
  391. {
  392. //The %s prevents %s from casting 3rd level or higher spells.
  393. text.appendLocalString(EMetaText::GENERAL_TXT, 536);
  394. text.replaceName(b->sid.as<ArtifactID>());
  395. caster->getCasterName(text);
  396. target.add(std::move(text), spells::Problem::NORMAL);
  397. }
  398. else if(b && b->source == BonusSource::TERRAIN_OVERLAY && VLC->battlefields()->getById(b->sid.as<BattleField>())->identifier == "cursed_ground")
  399. {
  400. text.appendLocalString(EMetaText::GENERAL_TXT, 537);
  401. target.add(std::move(text), spells::Problem::NORMAL);
  402. }
  403. else
  404. {
  405. return adaptGenericProblem(target);
  406. }
  407. }
  408. break;
  409. case ESpellCastProblem::WRONG_SPELL_TARGET:
  410. case ESpellCastProblem::STACK_IMMUNE_TO_SPELL:
  411. case ESpellCastProblem::NO_APPROPRIATE_TARGET:
  412. {
  413. MetaString text;
  414. text.appendLocalString(EMetaText::GENERAL_TXT, 185);
  415. target.add(std::move(text), spells::Problem::NORMAL);
  416. }
  417. break;
  418. case ESpellCastProblem::INVALID:
  419. {
  420. MetaString text;
  421. text.appendRawString("Internal error during check of spell cast.");
  422. target.add(std::move(text), spells::Problem::CRITICAL);
  423. }
  424. break;
  425. default:
  426. return adaptGenericProblem(target);
  427. }
  428. return false;
  429. }
  430. int32_t BaseMechanics::getSpellIndex() const
  431. {
  432. return getSpellId().toEnum();
  433. }
  434. SpellID BaseMechanics::getSpellId() const
  435. {
  436. return owner->getId();
  437. }
  438. std::string BaseMechanics::getSpellName() const
  439. {
  440. return owner->getNameTranslated();
  441. }
  442. int32_t BaseMechanics::getSpellLevel() const
  443. {
  444. return owner->getLevel();
  445. }
  446. bool BaseMechanics::isSmart() const
  447. {
  448. if(boost::logic::indeterminate(smart))
  449. {
  450. const CSpell::TargetInfo targetInfo(owner, getRangeLevel(), mode);
  451. return targetInfo.smart;
  452. }
  453. else
  454. {
  455. return (bool)smart;
  456. }
  457. }
  458. bool BaseMechanics::isMassive() const
  459. {
  460. if(boost::logic::indeterminate(massive))
  461. {
  462. const CSpell::TargetInfo targetInfo(owner, getRangeLevel(), mode);
  463. return targetInfo.massive;
  464. }
  465. else
  466. {
  467. return (bool)massive;
  468. }
  469. }
  470. bool BaseMechanics::requiresClearTiles() const
  471. {
  472. const CSpell::TargetInfo targetInfo(owner, getRangeLevel(), mode);
  473. return targetInfo.clearAffected;
  474. }
  475. bool BaseMechanics::alwaysHitFirstTarget() const
  476. {
  477. return mode == Mode::SPELL_LIKE_ATTACK;
  478. }
  479. bool BaseMechanics::isNegativeSpell() const
  480. {
  481. return owner->isNegative();
  482. }
  483. bool BaseMechanics::isPositiveSpell() const
  484. {
  485. return owner->isPositive();
  486. }
  487. bool BaseMechanics::isMagicalEffect() const
  488. {
  489. return owner->isMagical();
  490. }
  491. int64_t BaseMechanics::adjustEffectValue(const battle::Unit * target) const
  492. {
  493. return owner->adjustRawDamage(caster, target, getEffectValue());
  494. }
  495. int64_t BaseMechanics::applySpellBonus(int64_t value, const battle::Unit * target) const
  496. {
  497. return caster->getSpellBonus(owner, value, target);
  498. }
  499. int64_t BaseMechanics::applySpecificSpellBonus(int64_t value) const
  500. {
  501. return caster->getSpecificSpellBonus(owner, value);
  502. }
  503. int64_t BaseMechanics::calculateRawEffectValue(int32_t basePowerMultiplier, int32_t levelPowerMultiplier) const
  504. {
  505. return owner->calculateRawEffectValue(getEffectLevel(), basePowerMultiplier, levelPowerMultiplier);
  506. }
  507. bool BaseMechanics::ownerMatches(const battle::Unit * unit) const
  508. {
  509. return ownerMatches(unit, owner->getPositiveness());
  510. }
  511. bool BaseMechanics::ownerMatches(const battle::Unit * unit, const boost::logic::tribool positivness) const
  512. {
  513. return cb->battleMatchOwner(caster->getCasterOwner(), unit, positivness);
  514. }
  515. IBattleCast::Value BaseMechanics::getEffectLevel() const
  516. {
  517. return effectLevel;
  518. }
  519. IBattleCast::Value BaseMechanics::getRangeLevel() const
  520. {
  521. return rangeLevel;
  522. }
  523. IBattleCast::Value BaseMechanics::getEffectPower() const
  524. {
  525. return effectPower;
  526. }
  527. IBattleCast::Value BaseMechanics::getEffectDuration() const
  528. {
  529. return effectDuration;
  530. }
  531. IBattleCast::Value64 BaseMechanics::getEffectValue() const
  532. {
  533. return effectValue;
  534. }
  535. PlayerColor BaseMechanics::getCasterColor() const
  536. {
  537. return caster->getCasterOwner();
  538. }
  539. std::vector<AimType> BaseMechanics::getTargetTypes() const
  540. {
  541. std::vector<AimType> ret;
  542. detail::ProblemImpl ignored;
  543. if(canBeCast(ignored))
  544. {
  545. auto spellTargetType = owner->getTargetType();
  546. if(isMassive())
  547. spellTargetType = AimType::NO_TARGET;
  548. else if(spellTargetType == AimType::OBSTACLE)
  549. spellTargetType = AimType::LOCATION;
  550. ret.push_back(spellTargetType);
  551. }
  552. return ret;
  553. }
  554. const CreatureService * BaseMechanics::creatures() const
  555. {
  556. return VLC->creatures(); //todo: redirect
  557. }
  558. #if SCRIPTING_ENABLED
  559. const scripting::Service * BaseMechanics::scripts() const
  560. {
  561. return VLC->scripts(); //todo: redirect
  562. }
  563. #endif
  564. const Service * BaseMechanics::spells() const
  565. {
  566. return VLC->spells(); //todo: redirect
  567. }
  568. const CBattleInfoCallback * BaseMechanics::battle() const
  569. {
  570. return cb;
  571. }
  572. } //namespace spells
  573. ///IAdventureSpellMechanics
  574. IAdventureSpellMechanics::IAdventureSpellMechanics(const CSpell * s)
  575. : owner(s)
  576. {
  577. }
  578. std::unique_ptr<IAdventureSpellMechanics> IAdventureSpellMechanics::createMechanics(const CSpell * s)
  579. {
  580. switch(s->id.toEnum())
  581. {
  582. case SpellID::SUMMON_BOAT:
  583. return std::make_unique<SummonBoatMechanics>(s);
  584. case SpellID::SCUTTLE_BOAT:
  585. return std::make_unique<ScuttleBoatMechanics>(s);
  586. case SpellID::DIMENSION_DOOR:
  587. return std::make_unique<DimensionDoorMechanics>(s);
  588. case SpellID::FLY:
  589. case SpellID::WATER_WALK:
  590. case SpellID::VISIONS:
  591. case SpellID::DISGUISE:
  592. return std::make_unique<AdventureSpellMechanics>(s); //implemented using bonus system
  593. case SpellID::TOWN_PORTAL:
  594. return std::make_unique<TownPortalMechanics>(s);
  595. case SpellID::VIEW_EARTH:
  596. return std::make_unique<ViewEarthMechanics>(s);
  597. case SpellID::VIEW_AIR:
  598. return std::make_unique<ViewAirMechanics>(s);
  599. default:
  600. return s->isCombat() ? std::unique_ptr<IAdventureSpellMechanics>() : std::make_unique<AdventureSpellMechanics>(s);
  601. }
  602. }
  603. VCMI_LIB_NAMESPACE_END