2015-02-02 10:40:06 +02:00
|
|
|
/*
|
|
|
|
* BattleSpellMechanics.cpp, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include "StdInc.h"
|
|
|
|
|
|
|
|
#include "BattleSpellMechanics.h"
|
2015-02-02 11:22:19 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
#include "Problem.h"
|
|
|
|
#include "CSpellHandler.h"
|
|
|
|
|
|
|
|
#include "../battle/IBattleState.h"
|
|
|
|
#include "../battle/CBattleInfoCallback.h"
|
2023-10-23 12:59:15 +02:00
|
|
|
#include "../networkPacks/PacksForClientBattle.h"
|
2023-10-24 00:27:52 +02:00
|
|
|
#include "../networkPacks/SetStackEffect.h"
|
2017-03-17 17:48:44 +02:00
|
|
|
#include "../CStack.h"
|
2024-06-01 17:28:17 +02:00
|
|
|
|
|
|
|
#include <vstd/RNG.h>
|
2015-02-02 11:22:19 +02:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
namespace spells
|
2017-06-06 06:53:51 +02:00
|
|
|
{
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
namespace SRSLPraserHelpers
|
2015-09-16 06:33:36 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
static int XYToHex(int x, int y)
|
|
|
|
{
|
|
|
|
return x + GameConstants::BFIELD_WIDTH * y;
|
|
|
|
}
|
2015-09-16 06:33:36 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
static int XYToHex(std::pair<int, int> xy)
|
2015-09-16 06:33:36 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
return XYToHex(xy.first, xy.second);
|
2015-09-16 06:33:36 +02:00
|
|
|
}
|
2015-09-16 08:44:18 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
static int hexToY(int battleFieldPosition)
|
|
|
|
{
|
|
|
|
return battleFieldPosition/GameConstants::BFIELD_WIDTH;
|
|
|
|
}
|
2015-09-16 06:33:36 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
static int hexToX(int battleFieldPosition)
|
|
|
|
{
|
|
|
|
int pos = battleFieldPosition - hexToY(battleFieldPosition) * GameConstants::BFIELD_WIDTH;
|
|
|
|
return pos;
|
|
|
|
}
|
2017-06-06 06:53:51 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
static std::pair<int, int> hexToPair(int battleFieldPosition)
|
|
|
|
{
|
|
|
|
return std::make_pair(hexToX(battleFieldPosition), hexToY(battleFieldPosition));
|
|
|
|
}
|
2015-04-03 02:28:20 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
//moves hex by one hex in given direction
|
|
|
|
//0 - left top, 1 - right top, 2 - right, 3 - right bottom, 4 - left bottom, 5 - left
|
|
|
|
static std::pair<int, int> gotoDir(int x, int y, int direction)
|
2015-04-03 02:28:20 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
switch(direction)
|
2016-02-15 12:34:37 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
case 0: //top left
|
|
|
|
return std::make_pair((y%2) ? x-1 : x, y-1);
|
|
|
|
case 1: //top right
|
|
|
|
return std::make_pair((y%2) ? x : x+1, y-1);
|
|
|
|
case 2: //right
|
|
|
|
return std::make_pair(x+1, y);
|
|
|
|
case 3: //right bottom
|
|
|
|
return std::make_pair((y%2) ? x : x+1, y+1);
|
|
|
|
case 4: //left bottom
|
|
|
|
return std::make_pair((y%2) ? x-1 : x, y+1);
|
|
|
|
case 5: //left
|
|
|
|
return std::make_pair(x-1, y);
|
|
|
|
default:
|
|
|
|
throw std::runtime_error("Disaster: wrong direction in SRSLPraserHelpers::gotoDir!\n");
|
2015-04-03 02:28:20 +02:00
|
|
|
}
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
2016-09-30 00:54:40 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
static std::pair<int, int> gotoDir(std::pair<int, int> xy, int direction)
|
2015-02-02 11:22:19 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
return gotoDir(xy.first, xy.second, direction);
|
2015-02-02 11:22:19 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
static bool isGoodHex(std::pair<int, int> xy)
|
2015-02-02 11:22:19 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
return xy.first >=0 && xy.first < GameConstants::BFIELD_WIDTH && xy.second >= 0 && xy.second < GameConstants::BFIELD_HEIGHT;
|
2015-02-26 19:59:18 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
//helper function for rangeInHexes
|
|
|
|
static std::set<ui16> getInRange(unsigned int center, int low, int high)
|
|
|
|
{
|
|
|
|
std::set<ui16> ret;
|
|
|
|
if(low == 0)
|
|
|
|
{
|
|
|
|
ret.insert(center);
|
|
|
|
}
|
2015-02-02 11:22:19 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::pair<int, int> mainPointForLayer[6]; //A, B, C, D, E, F points
|
|
|
|
for(auto & elem : mainPointForLayer)
|
|
|
|
elem = hexToPair(center);
|
2017-06-06 06:53:51 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
for(int it=1; it<=high; ++it) //it - distance to the center
|
|
|
|
{
|
|
|
|
for(int b=0; b<6; ++b)
|
|
|
|
mainPointForLayer[b] = gotoDir(mainPointForLayer[b], b);
|
2015-02-02 11:22:19 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
if(it>=low)
|
|
|
|
{
|
|
|
|
std::pair<int, int> curHex;
|
2016-03-05 03:46:32 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
//adding lines (A-b, B-c, C-d, etc)
|
|
|
|
for(int v=0; v<6; ++v)
|
|
|
|
{
|
|
|
|
curHex = mainPointForLayer[v];
|
|
|
|
for(int h=0; h<it; ++h)
|
|
|
|
{
|
|
|
|
if(isGoodHex(curHex))
|
|
|
|
ret.insert(XYToHex(curHex));
|
|
|
|
curHex = gotoDir(curHex, (v+2)%6);
|
|
|
|
}
|
|
|
|
}
|
2015-02-02 11:22:19 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
} //if(it>=low)
|
|
|
|
}
|
2015-02-02 11:22:19 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
return ret;
|
2015-02-02 11:22:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-11 17:18:05 +02:00
|
|
|
BattleSpellMechanics::BattleSpellMechanics(const IBattleCast * event,
|
|
|
|
std::shared_ptr<effects::Effects> effects_,
|
|
|
|
std::shared_ptr<IReceptiveCheck> targetCondition_):
|
|
|
|
BaseMechanics(event),
|
|
|
|
effects(std::move(effects_)),
|
|
|
|
targetCondition(std::move(targetCondition_))
|
2017-07-20 06:08:49 +02:00
|
|
|
{}
|
2015-02-02 11:22:19 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
BattleSpellMechanics::~BattleSpellMechanics() = default;
|
2015-09-16 06:56:02 +02:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
void BattleSpellMechanics::applyEffects(ServerCallback * server, const Target & targets, bool indirect, bool ignoreImmunity) const
|
2017-07-04 13:24:46 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
auto callback = [&](const effects::Effect * effect, bool & stop)
|
|
|
|
{
|
|
|
|
if(indirect == effect->indirect)
|
|
|
|
{
|
|
|
|
if(ignoreImmunity)
|
|
|
|
{
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
effect->apply(server, this, targets);
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EffectTarget filtered = effect->filterTarget(this, targets);
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
effect->apply(server, this, filtered);
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
effects->forEachEffect(getEffectLevel(), callback);
|
2017-07-04 13:24:46 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
bool BattleSpellMechanics::canBeCast(Problem & problem) const
|
2016-09-11 12:48:14 +02:00
|
|
|
{
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
auto genProblem = battle()->battleCanCastSpell(caster, mode);
|
|
|
|
if(genProblem != ESpellCastProblem::OK)
|
|
|
|
return adaptProblem(genProblem, problem);
|
|
|
|
|
|
|
|
switch(mode)
|
|
|
|
{
|
|
|
|
case Mode::HERO:
|
|
|
|
{
|
2023-02-11 17:18:05 +02:00
|
|
|
const auto * castingHero = dynamic_cast<const CGHeroInstance *>(caster); //todo: unify hero|creature spell cost
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
if(!castingHero)
|
|
|
|
{
|
|
|
|
logGlobal->debug("CSpell::canBeCast: invalid caster");
|
|
|
|
genProblem = ESpellCastProblem::NO_HERO_TO_CAST_SPELL;
|
|
|
|
}
|
|
|
|
else if(!castingHero->getArt(ArtifactPosition::SPELLBOOK))
|
|
|
|
genProblem = ESpellCastProblem::NO_SPELLBOOK;
|
|
|
|
else if(!castingHero->canCastThisSpell(owner))
|
|
|
|
genProblem = ESpellCastProblem::HERO_DOESNT_KNOW_SPELL;
|
|
|
|
else if(castingHero->mana < battle()->battleGetSpellCost(owner, castingHero)) //not enough mana
|
|
|
|
genProblem = ESpellCastProblem::NOT_ENOUGH_MANA;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(genProblem != ESpellCastProblem::OK)
|
|
|
|
return adaptProblem(genProblem, problem);
|
|
|
|
|
|
|
|
if(!owner->isCombat())
|
|
|
|
return adaptProblem(ESpellCastProblem::ADVMAP_SPELL_INSTEAD_OF_BATTLE_SPELL, problem);
|
|
|
|
|
|
|
|
const PlayerColor player = caster->getCasterOwner();
|
2024-08-11 22:22:35 +02:00
|
|
|
const BattleSide side = battle()->playerToSide(player);
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
|
2024-08-11 22:22:35 +02:00
|
|
|
if(side == BattleSide::NONE)
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
return adaptProblem(ESpellCastProblem::INVALID, problem);
|
|
|
|
|
|
|
|
//effect like Recanter's Cloak. Blocks also passive casting.
|
|
|
|
//TODO: check creature abilities to block
|
|
|
|
//TODO: check any possible caster
|
|
|
|
|
2024-08-11 22:22:35 +02:00
|
|
|
if(battle()->battleMaxSpellLevel(side) < getSpellLevel() || battle()->battleMinSpellLevel(side) > getSpellLevel())
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
return adaptProblem(ESpellCastProblem::SPELL_LEVEL_LIMIT_EXCEEDED, problem);
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
return effects->applicable(problem, this);
|
2016-09-11 12:48:14 +02:00
|
|
|
}
|
|
|
|
|
2021-02-20 03:57:50 +02:00
|
|
|
bool BattleSpellMechanics::canBeCastAt(const Target & target, Problem & problem) const
|
2016-09-11 12:48:14 +02:00
|
|
|
{
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
if(!canBeCast(problem))
|
|
|
|
return false;
|
2016-09-11 12:48:14 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
Target spellTarget = transformSpellTarget(target);
|
2017-06-06 06:53:51 +02:00
|
|
|
|
2024-01-15 23:14:32 +02:00
|
|
|
const battle::Unit * mainTarget = nullptr;
|
|
|
|
|
2024-09-28 17:32:53 +02:00
|
|
|
if(spellTarget.front().unitValue)
|
2024-01-15 23:14:32 +02:00
|
|
|
{
|
2024-09-28 17:32:53 +02:00
|
|
|
mainTarget = target.front().unitValue;
|
|
|
|
}
|
|
|
|
else if(spellTarget.front().hexValue.isValid())
|
|
|
|
{
|
|
|
|
mainTarget = battle()->battleGetUnitByPos(target.front().hexValue, true);
|
|
|
|
}
|
2024-01-15 23:14:32 +02:00
|
|
|
|
2024-09-28 17:32:53 +02:00
|
|
|
if (!getSpell()->canCastOnSelf() && !getSpell()->canCastOnlyOnSelf())
|
|
|
|
{
|
2024-09-19 03:14:45 +02:00
|
|
|
if(mainTarget && mainTarget == caster)
|
2024-01-16 15:01:42 +02:00
|
|
|
return false; // can't cast on self
|
2024-09-19 03:14:45 +02:00
|
|
|
|
2024-09-21 23:50:35 +02:00
|
|
|
if(mainTarget && mainTarget->hasBonusOfType(BonusType::INVINCIBLE) && !getSpell()->getPositiveness())
|
2024-09-19 03:14:45 +02:00
|
|
|
return false;
|
2024-01-16 15:01:42 +02:00
|
|
|
}
|
2024-09-28 17:32:53 +02:00
|
|
|
else if(getSpell()->canCastOnlyOnSelf())
|
|
|
|
{
|
|
|
|
if(mainTarget && mainTarget != caster)
|
|
|
|
return false; // can't cast on others
|
|
|
|
}
|
2024-01-15 23:14:32 +02:00
|
|
|
|
|
|
|
return effects->applicable(problem, this, target, spellTarget);
|
2015-02-02 11:22:19 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::vector<const CStack *> BattleSpellMechanics::getAffectedStacks(const Target & target) const
|
2015-04-03 00:52:20 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
Target spellTarget = transformSpellTarget(target);
|
2016-09-29 15:50:33 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
EffectTarget all;
|
|
|
|
|
|
|
|
effects->forEachEffect(getEffectLevel(), [&all, &target, &spellTarget, this](const effects::Effect * e, bool & stop)
|
2015-09-18 07:04:13 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
EffectTarget one = e->transformTarget(this, target, spellTarget);
|
|
|
|
vstd::concatenate(all, one);
|
|
|
|
});
|
2015-04-03 02:02:16 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::set<const CStack *> stacks;
|
2015-04-03 00:16:41 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
for(const Destination & dest : all)
|
2015-04-03 02:01:05 +02:00
|
|
|
{
|
2024-12-01 13:25:27 +02:00
|
|
|
if(dest.unitValue && !dest.unitValue->hasBonusOfType(BonusType::INVINCIBLE))
|
2015-04-03 02:01:05 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
//FIXME: remove and return battle::Unit
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
stacks.insert(battle()->battleGetStackByID(dest.unitValue->unitId(), false));
|
2015-04-03 02:01:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::vector<const CStack *> res;
|
|
|
|
std::copy(stacks.begin(), stacks.end(), std::back_inserter(res));
|
|
|
|
return res;
|
2017-06-06 06:53:51 +02:00
|
|
|
}
|
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
void BattleSpellMechanics::cast(ServerCallback * server, const Target & target)
|
2015-03-18 12:27:07 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
BattleSpellCast sc;
|
2015-03-19 09:35:05 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
int spellCost = 0;
|
2015-03-19 09:35:05 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
sc.side = casterSide;
|
|
|
|
sc.spellID = getSpellId();
|
2023-08-31 17:45:52 +02:00
|
|
|
sc.battleID = battle()->getBattle()->getBattleID();
|
2017-07-20 06:08:49 +02:00
|
|
|
sc.tile = target.at(0).hexValue;
|
2015-03-19 09:35:05 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
sc.castByHero = mode == Mode::HERO;
|
2018-03-04 10:13:07 +02:00
|
|
|
sc.casterStack = caster->getCasterUnitId();
|
2017-07-20 06:08:49 +02:00
|
|
|
sc.manaGained = 0;
|
2015-03-19 09:35:05 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
sc.activeCast = false;
|
|
|
|
affectedUnits.clear();
|
2015-03-19 09:35:05 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
const CGHeroInstance * otherHero = nullptr;
|
2015-03-18 12:27:07 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
//check it there is opponent hero
|
2024-08-11 22:22:35 +02:00
|
|
|
const BattleSide otherSide = battle()->otherSide(casterSide);
|
2015-03-19 09:35:05 +02:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
if(battle()->battleHasHero(otherSide))
|
|
|
|
otherHero = battle()->battleGetFightingHero(otherSide);
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
2015-03-18 13:12:26 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
//calculate spell cost
|
|
|
|
if(mode == Mode::HERO)
|
|
|
|
{
|
2023-02-11 17:18:05 +02:00
|
|
|
const auto * casterHero = dynamic_cast<const CGHeroInstance *>(caster);
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
spellCost = battle()->battleGetSpellCost(owner, casterHero);
|
2015-03-19 09:35:05 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
if(nullptr != otherHero) //handle mana channel
|
2015-03-18 13:12:26 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
int manaChannel = 0;
|
2023-04-27 19:43:20 +02:00
|
|
|
for(const auto * stack : battle()->battleGetAllStacks(true)) //TODO: shouldn't bonus system handle it somehow?
|
2015-03-18 13:12:26 +02:00
|
|
|
{
|
2023-04-27 19:43:20 +02:00
|
|
|
if(stack->unitOwner() == otherHero->tempOwner)
|
2015-03-18 13:12:26 +02:00
|
|
|
{
|
2023-05-01 00:20:01 +02:00
|
|
|
vstd::amax(manaChannel, stack->valOfBonuses(BonusType::MANA_CHANNELING));
|
2015-03-18 13:12:26 +02:00
|
|
|
}
|
|
|
|
}
|
2017-07-20 06:08:49 +02:00
|
|
|
sc.manaGained = (manaChannel * spellCost) / 100;
|
2015-03-18 13:28:34 +02:00
|
|
|
}
|
2017-07-20 06:08:49 +02:00
|
|
|
sc.activeCast = true;
|
2017-07-12 21:01:10 +02:00
|
|
|
}
|
2017-07-20 06:08:49 +02:00
|
|
|
else if(mode == Mode::CREATURE_ACTIVE || mode == Mode::ENCHANTER)
|
2016-09-18 15:30:03 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
spellCost = 1;
|
|
|
|
sc.activeCast = true;
|
2016-09-18 15:30:03 +02:00
|
|
|
}
|
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
beforeCast(sc, *server->getRNG(), target);
|
|
|
|
|
|
|
|
BattleLogMessage castDescription;
|
2023-08-31 17:45:52 +02:00
|
|
|
castDescription.battleID = battle()->getBattle()->getBattleID();
|
2015-03-19 09:35:05 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
switch (mode)
|
2015-03-18 15:39:07 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
case Mode::CREATURE_ACTIVE:
|
|
|
|
case Mode::ENCHANTER:
|
|
|
|
case Mode::HERO:
|
|
|
|
case Mode::PASSIVE:
|
|
|
|
{
|
|
|
|
MetaString line;
|
|
|
|
caster->getCastDescription(owner, affectedUnits, line);
|
2023-06-18 11:18:25 +02:00
|
|
|
if(!line.empty())
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
castDescription.lines.push_back(line);
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
|
|
|
break;
|
2016-02-15 12:34:37 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
default:
|
|
|
|
break;
|
2015-03-18 16:48:32 +02:00
|
|
|
}
|
2015-03-19 09:35:05 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
doRemoveEffects(server, affectedUnits, std::bind(&BattleSpellMechanics::counteringSelector, this, _1));
|
2016-03-01 14:14:27 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
for(auto & unit : affectedUnits)
|
|
|
|
sc.affectedCres.insert(unit->unitId());
|
2016-03-01 14:14:27 +02:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
if(!castDescription.lines.empty())
|
2024-10-04 20:59:51 +02:00
|
|
|
server->apply(castDescription);
|
2015-03-18 15:39:07 +02:00
|
|
|
|
2024-10-04 20:59:51 +02:00
|
|
|
server->apply(sc);
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
|
|
|
|
for(auto & p : effectsToApply)
|
|
|
|
p.first->apply(server, this, p.second);
|
2016-09-05 10:36:25 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
if(sc.activeCast)
|
2015-02-02 11:22:19 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
caster->spendMana(server, spellCost);
|
2015-02-02 11:22:19 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
if(sc.manaGained > 0)
|
|
|
|
{
|
|
|
|
assert(otherHero);
|
|
|
|
otherHero->spendMana(server, -sc.manaGained);
|
|
|
|
}
|
|
|
|
}
|
2022-12-11 12:29:11 +02:00
|
|
|
|
|
|
|
// send empty event to client
|
|
|
|
// temporary(?) workaround to force animations to trigger
|
2023-08-31 17:45:52 +02:00
|
|
|
StacksInjured fakeEvent;
|
|
|
|
fakeEvent.battleID = battle()->getBattle()->getBattleID();
|
2024-10-04 20:59:51 +02:00
|
|
|
server->apply(fakeEvent);
|
2017-06-06 06:53:51 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
void BattleSpellMechanics::beforeCast(BattleSpellCast & sc, vstd::RNG & rng, const Target & target)
|
2016-03-04 18:11:42 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
affectedUnits.clear();
|
2016-03-04 18:11:42 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
Target spellTarget = transformSpellTarget(target);
|
2016-03-04 18:11:42 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::vector <const battle::Unit *> resisted;
|
2016-03-04 18:11:42 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
auto filterResisted = [&, this](const battle::Unit * unit) -> bool
|
|
|
|
{
|
2023-03-21 11:18:31 +02:00
|
|
|
if(isNegativeSpell() && isMagicalEffect())
|
2017-07-20 06:08:49 +02:00
|
|
|
{
|
|
|
|
//magic resistance
|
|
|
|
const int prob = std::min(unit->magicResistance(), 100); //probability of resistance in %
|
2024-06-01 15:36:38 +02:00
|
|
|
if(rng.nextInt(0, 99) < prob)
|
2017-07-20 06:08:49 +02:00
|
|
|
return true;
|
|
|
|
}
|
2016-09-23 19:27:55 +02:00
|
|
|
return false;
|
2017-07-20 06:08:49 +02:00
|
|
|
};
|
2016-09-23 19:27:55 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
auto filterUnit = [&](const battle::Unit * unit)
|
|
|
|
{
|
|
|
|
if(filterResisted(unit))
|
|
|
|
resisted.push_back(unit);
|
|
|
|
else
|
|
|
|
affectedUnits.push_back(unit);
|
|
|
|
};
|
2016-09-23 19:27:55 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
//prepare targets
|
|
|
|
effectsToApply = effects->prepare(this, target, spellTarget);
|
2016-09-24 10:25:29 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::set<const battle::Unit *> unitTargets = collectTargets();
|
2017-07-01 17:59:53 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
//process them
|
2023-02-11 17:18:05 +02:00
|
|
|
for(const auto * unit : unitTargets)
|
2017-07-20 06:08:49 +02:00
|
|
|
filterUnit(unit);
|
2016-09-23 19:27:55 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
//and update targets
|
|
|
|
for(auto & p : effectsToApply)
|
2016-09-23 12:14:12 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
vstd::erase_if(p.second, [&](const Destination & d)
|
|
|
|
{
|
|
|
|
if(!d.unitValue)
|
|
|
|
return false;
|
|
|
|
return vstd::contains(resisted, d.unitValue);
|
|
|
|
});
|
2016-09-23 12:14:12 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
if(mode == Mode::MAGIC_MIRROR)
|
2015-02-02 11:22:19 +02:00
|
|
|
{
|
2023-04-12 22:56:12 +02:00
|
|
|
if(caster->getHeroCaster() == nullptr)
|
2017-07-20 06:08:49 +02:00
|
|
|
{
|
2022-12-17 17:35:15 +02:00
|
|
|
sc.reflectedCres.insert(caster->getCasterUnitId());
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
2016-09-05 12:34:48 +02:00
|
|
|
}
|
2015-02-02 11:22:19 +02:00
|
|
|
|
2023-02-11 17:18:05 +02:00
|
|
|
for(const auto * unit : resisted)
|
2022-12-17 17:35:15 +02:00
|
|
|
sc.resistedCres.insert(unit->unitId());
|
2016-09-05 12:34:48 +02:00
|
|
|
}
|
2015-02-02 11:22:19 +02:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
void BattleSpellMechanics::castEval(ServerCallback * server, const Target & target)
|
2017-06-06 06:53:51 +02:00
|
|
|
{
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
affectedUnits.clear();
|
2017-07-20 06:08:49 +02:00
|
|
|
//TODO: evaluate caster updates (mana usage etc.)
|
|
|
|
//TODO: evaluate random values
|
2017-06-06 06:53:51 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
Target spellTarget = transformSpellTarget(target);
|
2016-09-24 10:25:29 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
effectsToApply = effects->prepare(this, target, spellTarget);
|
2016-09-24 10:25:29 +02:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
std::set<const battle::Unit *> unitTargets = collectTargets();
|
2016-09-05 12:34:48 +02:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
auto selector = std::bind(&BattleSpellMechanics::counteringSelector, this, _1);
|
2017-06-06 06:53:51 +02:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
std::copy(std::begin(unitTargets), std::end(unitTargets), std::back_inserter(affectedUnits));
|
|
|
|
doRemoveEffects(server, affectedUnits, selector);
|
2016-09-05 12:34:48 +02:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
for(auto & p : effectsToApply)
|
|
|
|
p.first->apply(server, this, p.second);
|
2016-09-05 10:36:25 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::set<const battle::Unit *> BattleSpellMechanics::collectTargets() const
|
2015-02-02 11:22:19 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
std::set<const battle::Unit *> result;
|
2015-02-26 19:59:18 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
for(const auto & p : effectsToApply)
|
2015-02-02 11:22:19 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
for(const Destination & d : p.second)
|
|
|
|
if(d.unitValue)
|
|
|
|
result.insert(d.unitValue);
|
2015-02-02 11:22:19 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
return result;
|
2017-06-06 06:53:51 +02:00
|
|
|
}
|
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
void BattleSpellMechanics::doRemoveEffects(ServerCallback * server, const std::vector<const battle::Unit *> & targets, const CSelector & selector)
|
2016-09-05 12:34:48 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
SetStackEffect sse;
|
2023-08-31 17:45:52 +02:00
|
|
|
sse.battleID = battle()->getBattle()->getBattleID();
|
2016-09-05 12:34:48 +02:00
|
|
|
|
2023-02-11 17:18:05 +02:00
|
|
|
for(const auto * unit : targets)
|
2016-09-05 12:34:48 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
std::vector<Bonus> buffer;
|
|
|
|
auto bl = unit->getBonuses(selector);
|
2016-09-05 12:34:48 +02:00
|
|
|
|
2023-02-11 17:18:05 +02:00
|
|
|
for(const auto & item : *bl)
|
2017-07-20 06:08:49 +02:00
|
|
|
buffer.emplace_back(*item);
|
2016-09-05 12:34:48 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
if(!buffer.empty())
|
2023-02-11 17:18:05 +02:00
|
|
|
sse.toRemove.emplace_back(unit->unitId(), buffer);
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
2017-06-06 06:53:51 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
if(!sse.toRemove.empty())
|
2024-10-04 20:59:51 +02:00
|
|
|
server->apply(sse);
|
2016-09-05 12:34:48 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
bool BattleSpellMechanics::counteringSelector(const Bonus * bonus) const
|
2016-09-05 12:34:48 +02:00
|
|
|
{
|
2023-05-01 00:20:01 +02:00
|
|
|
if(bonus->source != BonusSource::SPELL_EFFECT)
|
2017-07-20 06:08:49 +02:00
|
|
|
return false;
|
2016-09-05 12:34:48 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
for(const SpellID & id : owner->counteredSpells)
|
2016-09-05 12:34:48 +02:00
|
|
|
{
|
2023-10-10 17:05:18 +02:00
|
|
|
if(bonus->sid.as<SpellID>() == id)
|
2017-07-20 06:08:49 +02:00
|
|
|
return true;
|
2016-09-05 12:34:48 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
return false;
|
2016-09-05 12:34:48 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::set<BattleHex> BattleSpellMechanics::spellRangeInHexes(BattleHex centralHex) const
|
2017-06-06 06:53:51 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
using namespace SRSLPraserHelpers;
|
2017-06-06 06:53:51 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::set<BattleHex> ret;
|
2024-08-10 14:22:21 +02:00
|
|
|
std::vector<int> rng = owner->getLevelInfo(getRangeLevel()).range;
|
2017-07-20 06:08:49 +02:00
|
|
|
|
2024-08-10 14:22:21 +02:00
|
|
|
for(auto & elem : rng)
|
2015-02-02 11:22:19 +02:00
|
|
|
{
|
2024-08-10 14:22:21 +02:00
|
|
|
std::set<ui16> curLayer = getInRange(centralHex, elem, elem);
|
|
|
|
//adding obtained hexes
|
|
|
|
for(const auto & curLayer_it : curLayer)
|
|
|
|
ret.insert(curLayer_it);
|
2016-09-18 15:30:03 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
return ret;
|
2016-03-01 11:20:38 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
Target BattleSpellMechanics::transformSpellTarget(const Target & aimPoint) const
|
2016-03-01 11:20:38 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
Target spellTarget;
|
2016-03-01 11:20:38 +02:00
|
|
|
|
2023-02-11 17:18:05 +02:00
|
|
|
if(aimPoint.empty())
|
2016-03-01 10:55:09 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
logGlobal->error("Aimed spell cast with no destination.");
|
2016-03-01 10:55:09 +02:00
|
|
|
}
|
2017-07-04 13:24:46 +02:00
|
|
|
else
|
2016-09-18 15:30:03 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
const Destination & primary = aimPoint.at(0);
|
2018-10-29 17:56:14 +02:00
|
|
|
BattleHex aimPointHex = primary.hexValue;
|
2015-04-03 02:02:16 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
//transform primary spell target with spell range (if it`s valid), leave anything else to effects
|
2016-02-15 12:34:37 +02:00
|
|
|
|
2018-10-29 17:56:14 +02:00
|
|
|
if(aimPointHex.isValid())
|
2015-04-02 23:35:29 +02:00
|
|
|
{
|
2018-10-29 17:56:14 +02:00
|
|
|
auto spellRange = spellRangeInHexes(aimPointHex);
|
2023-02-11 17:18:05 +02:00
|
|
|
for(const auto & hex : spellRange)
|
2017-07-20 06:08:49 +02:00
|
|
|
spellTarget.push_back(Destination(hex));
|
2015-04-02 23:35:29 +02:00
|
|
|
}
|
|
|
|
}
|
2015-04-03 02:02:16 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
if(spellTarget.empty())
|
|
|
|
spellTarget.push_back(Destination(BattleHex::INVALID));
|
2015-04-02 23:35:29 +02:00
|
|
|
|
2019-01-19 12:52:02 +02:00
|
|
|
return spellTarget;
|
2015-02-02 11:22:19 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::vector<AimType> BattleSpellMechanics::getTargetTypes() const
|
2015-09-16 08:44:18 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
auto ret = BaseMechanics::getTargetTypes();
|
2015-10-01 01:36:00 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
if(!ret.empty())
|
2015-10-01 01:36:00 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
effects->forEachEffect(getEffectLevel(), [&](const effects::Effect * e, bool & stop)
|
|
|
|
{
|
|
|
|
e->adjustTargetTypes(ret);
|
|
|
|
stop = ret.empty();
|
|
|
|
});
|
2015-10-01 01:36:00 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
return ret;
|
2015-09-16 08:44:18 +02:00
|
|
|
}
|
2015-02-02 11:22:19 +02:00
|
|
|
|
2023-08-08 17:38:41 +02:00
|
|
|
std::vector<Destination> BattleSpellMechanics::getPossibleDestinations(size_t index, AimType aimType, const Target & current, bool fast) const
|
2016-09-05 10:36:25 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
//TODO: BattleSpellMechanics::getPossibleDestinations
|
2016-09-05 10:36:25 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
if(index != 0)
|
|
|
|
return std::vector<Destination>();
|
2017-06-06 06:53:51 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::vector<Destination> ret;
|
2016-03-04 15:42:55 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
switch(aimType)
|
2016-09-29 09:45:22 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
case AimType::CREATURE:
|
2023-08-08 17:38:41 +02:00
|
|
|
{
|
|
|
|
auto stacks = battle()->battleGetAllStacks();
|
|
|
|
|
|
|
|
for(auto stack : stacks)
|
|
|
|
{
|
|
|
|
Target tmp = current;
|
|
|
|
tmp.emplace_back(stack->getPosition());
|
|
|
|
|
|
|
|
detail::ProblemImpl ignored;
|
|
|
|
|
|
|
|
if(canBeCastAt(tmp, ignored))
|
|
|
|
ret.emplace_back(stack->getPosition());
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
case AimType::LOCATION:
|
2023-08-08 17:38:41 +02:00
|
|
|
if(fast)
|
|
|
|
{
|
|
|
|
auto stacks = battle()->battleGetAllStacks();
|
|
|
|
std::set<BattleHex> hexesToCheck;
|
|
|
|
|
|
|
|
for(auto stack : stacks)
|
|
|
|
{
|
|
|
|
hexesToCheck.insert(stack->getPosition());
|
|
|
|
|
|
|
|
for(auto adjacent : stack->getPosition().neighbouringTiles())
|
|
|
|
hexesToCheck.insert(adjacent);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(auto hex : hexesToCheck)
|
|
|
|
{
|
|
|
|
if(hex.isAvailable())
|
|
|
|
{
|
|
|
|
Target tmp = current;
|
|
|
|
tmp.emplace_back(hex);
|
|
|
|
|
|
|
|
detail::ProblemImpl ignored;
|
|
|
|
|
|
|
|
if(canBeCastAt(tmp, ignored))
|
|
|
|
ret.emplace_back(hex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2016-09-29 17:55:07 +02:00
|
|
|
{
|
2023-08-08 17:38:41 +02:00
|
|
|
for(int i = 0; i < GameConstants::BFIELD_SIZE; i++)
|
2016-09-29 17:55:07 +02:00
|
|
|
{
|
2023-08-08 17:38:41 +02:00
|
|
|
BattleHex dest(i);
|
|
|
|
if(dest.isAvailable())
|
|
|
|
{
|
|
|
|
Target tmp = current;
|
|
|
|
tmp.emplace_back(dest);
|
2017-07-20 06:08:49 +02:00
|
|
|
|
2023-08-08 17:38:41 +02:00
|
|
|
detail::ProblemImpl ignored;
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
|
2023-08-08 17:38:41 +02:00
|
|
|
if(canBeCastAt(tmp, ignored))
|
|
|
|
ret.emplace_back(dest);
|
|
|
|
}
|
2016-09-29 17:55:07 +02:00
|
|
|
}
|
|
|
|
}
|
2017-07-20 06:08:49 +02:00
|
|
|
break;
|
|
|
|
case AimType::NO_TARGET:
|
|
|
|
ret.emplace_back();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2016-09-29 17:55:07 +02:00
|
|
|
}
|
2016-09-29 09:45:22 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
return ret;
|
2015-02-02 11:22:19 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
bool BattleSpellMechanics::isReceptive(const battle::Unit * target) const
|
2017-06-06 06:53:51 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
return targetCondition->isReceptive(this, target);
|
2017-06-06 06:53:51 +02:00
|
|
|
}
|
|
|
|
|
2022-12-22 23:11:55 +02:00
|
|
|
std::vector<BattleHex> BattleSpellMechanics::rangeInHexes(BattleHex centralHex) const
|
2015-04-02 23:02:15 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
if(isMassive() || !centralHex.isValid())
|
|
|
|
return std::vector<BattleHex>(1, BattleHex::INVALID);
|
2016-09-18 15:30:03 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
Target aimPoint;
|
|
|
|
aimPoint.push_back(Destination(centralHex));
|
2016-02-15 12:34:37 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
Target spellTarget = transformSpellTarget(aimPoint);
|
2015-04-02 23:02:15 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::set<BattleHex> effectRange;
|
2015-04-02 23:02:15 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
effects->forEachEffect(getEffectLevel(), [&](const effects::Effect * effect, bool & stop)
|
2015-09-30 21:38:50 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
if(!effect->indirect)
|
2015-09-30 21:38:50 +02:00
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
effect->adjustAffectedHexes(effectRange, this, spellTarget);
|
2015-09-30 21:38:50 +02:00
|
|
|
}
|
2017-07-20 06:08:49 +02:00
|
|
|
});
|
2016-09-06 11:26:01 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::vector<BattleHex> ret;
|
|
|
|
ret.reserve(effectRange.size());
|
2016-09-06 11:26:01 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
std::copy(effectRange.begin(), effectRange.end(), std::back_inserter(ret));
|
2016-09-24 08:27:58 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
return ret;
|
2015-02-02 11:22:19 +02:00
|
|
|
}
|
2015-02-26 19:59:18 +02:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
const Spell * BattleSpellMechanics::getSpell() const
|
|
|
|
{
|
|
|
|
return owner;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-18 15:30:03 +02:00
|
|
|
}
|
2017-07-20 06:08:49 +02:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|