mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07: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.
This commit is contained in:
@@ -64,7 +64,7 @@ bool Sacrifice::applicable(Problem & problem, const Mechanics * m) const
|
||||
auto mainFilter = std::bind(&UnitEffect::getStackFilter, this, m, true, _1);
|
||||
auto predicate = std::bind(&UnitEffect::eraseByImmunityFilter, this, m, _1);
|
||||
|
||||
auto targets = m->cb->battleGetUnitsIf(mainFilter);
|
||||
auto targets = m->battle()->battleGetUnitsIf(mainFilter);
|
||||
vstd::erase_if(targets, predicate);
|
||||
|
||||
bool targetExists = false;
|
||||
@@ -117,7 +117,7 @@ bool Sacrifice::applicable(Problem & problem, const Mechanics * m, const EffectT
|
||||
return true;
|
||||
}
|
||||
|
||||
void Sacrifice::apply(BattleStateProxy * battleState, RNG & rng, const Mechanics * m, const EffectTarget & target) const
|
||||
void Sacrifice::apply(ServerCallback * server, const Mechanics * m, const EffectTarget & target) const
|
||||
{
|
||||
if(target.size() != 2)
|
||||
{
|
||||
@@ -136,11 +136,11 @@ void Sacrifice::apply(BattleStateProxy * battleState, RNG & rng, const Mechanics
|
||||
EffectTarget healTarget;
|
||||
healTarget.emplace_back(target.front());
|
||||
|
||||
Heal::apply(calculateHealEffectValue(m, victim), battleState, rng, m, healTarget);
|
||||
Heal::apply(calculateHealEffectValue(m, victim), server, m, healTarget);
|
||||
|
||||
BattleUnitsChanged removeUnits;
|
||||
removeUnits.changedStacks.emplace_back(victim->unitId(), UnitChanges::EOperation::REMOVE);
|
||||
battleState->apply(&removeUnits);
|
||||
server->apply(&removeUnits);
|
||||
}
|
||||
|
||||
bool Sacrifice::isValidTarget(const Mechanics * m, const battle::Unit * unit) const
|
||||
|
||||
Reference in New Issue
Block a user