mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
Probably fixed http://bugs.vcmi.eu/view.php?id=2523
This commit is contained in:
parent
921d2f6210
commit
e91a6d45e8
@ -788,14 +788,23 @@ bool SacrificeMechanics::requiresCreatureTarget() const
|
||||
///SpecialRisingSpellMechanics
|
||||
ESpellCastProblem::ESpellCastProblem SpecialRisingSpellMechanics::canBeCast(const CBattleInfoCallback * cb, const SpellTargetingContext & ctx) const
|
||||
{
|
||||
const CStack * stack = cb->getStackIf([ctx](const CStack * s)
|
||||
//find our possible target here
|
||||
const CStack * stackToHeal = cb->getStackIf([ctx](const CStack * s)
|
||||
{
|
||||
const bool ownerMatches = !ctx.ti.smart || s->getOwner() == ctx.caster->getOwner();
|
||||
|
||||
return ownerMatches && s->isValidTarget(!ctx.ti.onlyAlive) && s->coversPos(ctx.destination);
|
||||
});
|
||||
|
||||
if(nullptr == stack)
|
||||
//find if there is stack preventing cast
|
||||
const CStack * enemyStack = cb->getStackIf([ctx](const CStack * s)
|
||||
{
|
||||
const bool ownerMatches = ctx.ti.smart && s->getOwner() != ctx.caster->getOwner();
|
||||
|
||||
return ownerMatches && s->isValidTarget(true) && s->coversPos(ctx.destination);
|
||||
});
|
||||
|
||||
if(nullptr == stackToHeal || nullptr != enemyStack)
|
||||
return ESpellCastProblem::NO_APPROPRIATE_TARGET;
|
||||
|
||||
return ESpellCastProblem::OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user