From 6541e89f90c43aadc07a51d21b8066b533bc282f Mon Sep 17 00:00:00 2001 From: mateuszb Date: Fri, 21 May 2010 16:43:07 +0000 Subject: [PATCH] * support for orb of vulnerability * updated changelog --- ChangeLog | 10 +++++++++- server/CGameHandler.cpp | 28 ++++++++++++++++------------ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 39c7b6db2..63a1b8beb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,15 @@ GENERAL: * It's possible to start campaign * Support for build grail victory condition -* New artifacts supported: Angel's Wings and Boots of levitation +* New artifacts supported: +- Angel's Wings +- Boots of levitation +- Orb of Vulnerability +- Ammo cart +- Golden Bow +- Hourglass of Evil Hour +- Bow of Sharpshooter +- Armor of the Damned ADVENTURE MAP: * Creatures now guard surrounding tiles diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index dcb20ec45..13ff28215 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -3598,18 +3598,22 @@ static std::vector calculateResistedStacks(const CSpell * sp, const CGHero if (caster->hasBonusOfType(Bonus::NEGATE_ALL_NATURAL_IMMUNITIES) || hero2->hasBonusOfType(Bonus::NEGATE_ALL_NATURAL_IMMUNITIES)) { - //Here we need "source different than" selector -// BonusList bl = (*it)->getBonuses(Selector::sourceNotType(Bonus::CREATURE_ABILITY)); -// -// BOOST_FOREACH(Bonus bb, bl) -// { -// if(bb.type == Bonus::SPELL_IMMUNITY && bb.subtype == sp->id || //100% sure spell immunity -// bb.type == Bonus::LEVEL_SPELL_IMMUNITY && bb.val >= sp->level) //some creature abilities have level 0 -// { -// ret.push_back((*it)->ID); -// continue; -// } -// } + //don't use natural immunities when one of heroes has this bonus + BonusList bl = (*it)->getBonuses(Selector::type(Bonus::SPELL_IMMUNITY)), + b2 = (*it)->getBonuses(Selector::type(Bonus::LEVEL_SPELL_IMMUNITY)); + + bl.insert(bl.end(), b2.begin(), b2.end()); + + BOOST_FOREACH(Bonus bb, bl) + { + if( (bb.type == Bonus::SPELL_IMMUNITY && bb.subtype == sp->id || //100% sure spell immunity + bb.type == Bonus::LEVEL_SPELL_IMMUNITY && bb.val >= sp->level) //some creature abilities have level 0 + && bb.source != Bonus::CREATURE_ABILITY) + { + ret.push_back((*it)->ID); + continue; + } + } } else {