From 97a8380d0794a9a853e6e51378ab4fce10d383b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kalinowski?= Date: Fri, 29 Mar 2019 12:10:26 +0100 Subject: [PATCH] Simplification fixes Return statement fixes --- lib/spells/TargetCondition.cpp | 12 ++++++------ lib/spells/effects/Dispel.cpp | 2 +- lib/spells/effects/Sacrifice.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/spells/TargetCondition.cpp b/lib/spells/TargetCondition.cpp index 61bf0b43c..96a5f27dc 100644 --- a/lib/spells/TargetCondition.cpp +++ b/lib/spells/TargetCondition.cpp @@ -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; } }; diff --git a/lib/spells/effects/Dispel.cpp b/lib/spells/effects/Dispel.cpp index 576bd25e2..798d6b212 100644 --- a/lib/spells/effects/Dispel.cpp +++ b/lib/spells/effects/Dispel.cpp @@ -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; diff --git a/lib/spells/effects/Sacrifice.cpp b/lib/spells/effects/Sacrifice.cpp index 1e8347952..a0d888335 100644 --- a/lib/spells/effects/Sacrifice.cpp +++ b/lib/spells/effects/Sacrifice.cpp @@ -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;