1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Simplification fixes

Return statement fixes
This commit is contained in:
Michał Kalinowski 2019-03-29 12:10:26 +01:00 committed by Alexander Shishkin
parent ac6b477aa2
commit 97a8380d07
3 changed files with 8 additions and 8 deletions

View File

@ -117,9 +117,9 @@ protected:
TBonusListPtr levelImmunities = target->getBonuses(Selector::type(Bonus::LEVEL_SPELL_IMMUNITY).And(Selector::info(1)), cachingStr.str());
return !(levelImmunities->size() > 0
&& levelImmunities->totalValue() >= m->getSpellLevel()
&& m->getSpellLevel() > 0);
return levelImmunities->size() == 0 ||
levelImmunities->totalValue() < m->getSpellLevel() ||
m->getSpellLevel() <= 0;
}
};
@ -191,9 +191,9 @@ protected:
bool check(const Mechanics * m, const battle::Unit * target) const override
{
TBonusListPtr levelImmunities = target->getBonuses(Selector::type(Bonus::LEVEL_SPELL_IMMUNITY));
return !(levelImmunities->size() > 0 &&
levelImmunities->totalValue() >= m->getSpellLevel() &&
m->getSpellLevel() > 0);
return levelImmunities->size() == 0 ||
levelImmunities->totalValue() < m->getSpellLevel() ||
m->getSpellLevel() <= 0;
}
};

View File

@ -102,7 +102,7 @@ bool Dispel::mainSelector(const Bonus * bonus)
if(sourceSpell->id == SpellID::CLONE)
return false;
//stack may have inherited effects
return !sourceSpell->isAdventureSpell();
return sourceSpell->isCombatSpell();
}
//not spell effect
return false;

View File

@ -111,7 +111,7 @@ bool Sacrifice::applicable(Problem & problem, const Mechanics * m, const EffectT
if(!victim)
return false;
return !(!victim->alive() || !getStackFilter(m, false, victim) || !isReceptive(m, victim));
return victim->alive() && getStackFilter(m, false, victim) && isReceptive(m, victim);
}
return true;