From 7874dffa7dff7d44ab99518f12a5c7999ceed5d9 Mon Sep 17 00:00:00 2001 From: AlexVinS Date: Sat, 24 Sep 2016 10:06:24 +0300 Subject: [PATCH] fixed http://bugs.vcmi.eu/view.php?id=2282 --- lib/NetPacks.h | 1 + lib/NetPacksLib.cpp | 12 ++++++++++++ lib/spells/BattleSpellMechanics.cpp | 2 ++ server/CGameHandler.cpp | 2 ++ 4 files changed, 17 insertions(+) diff --git a/lib/NetPacks.h b/lib/NetPacks.h index f0f3811ed..d7741e829 100644 --- a/lib/NetPacks.h +++ b/lib/NetPacks.h @@ -1365,6 +1365,7 @@ struct StacksHealedOrResurrected : public CPackForClient //3013 bool lifeDrain; //if true, this heal is an effect of life drain bool tentHealing; //if true, than it's healing via First Aid Tent si32 drainedFrom; //if life drain - then stack life was drain from, if tentHealing - stack that is a healer + bool cure; //archangel cast also remove negative effects template void serialize(Handler &h, const int version) { diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index 510008dd8..1592ac50f 100644 --- a/lib/NetPacksLib.cpp +++ b/lib/NetPacksLib.cpp @@ -1623,6 +1623,18 @@ DLL_LINKAGE void StacksHealedOrResurrected::applyGs( CGameState *gs ) } vstd::amin(changedStack->firstHPleft, changedStack->MaxHealth()); if(resurrected) + { + //removing all spells effects + auto selector = [](const Bonus * b) + { + const CSpell *s = b->sourceSpell(); + //Special case: DISRUPTING_RAY is "immune" to dispell + //Other even PERMANENT effects can be removed + return (s != nullptr) && (s->id != SpellID::DISRUPTING_RAY); + }; + changedStack->popBonuses(selector); + } + else if(cure) { //removing all effects from negative spells auto selector = [](const Bonus * b) diff --git a/lib/spells/BattleSpellMechanics.cpp b/lib/spells/BattleSpellMechanics.cpp index 2dd260861..553385c9d 100644 --- a/lib/spells/BattleSpellMechanics.cpp +++ b/lib/spells/BattleSpellMechanics.cpp @@ -24,6 +24,8 @@ void HealingSpellMechanics::applyBattleEffects(const SpellCastEnvironment * env, StacksHealedOrResurrected shr; shr.lifeDrain = false; shr.tentHealing = false; + //special case for Archangel + shr.cure = parameters.mode == ECastingMode::CREATURE_ACTIVE_CASTING && owner->id == SpellID::RESURRECTION; const bool resurrect = (healLevel != EHealLevel::HEAL); for(auto & attackedCre : ctx.attackedCres) diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 18f8089f6..02cd307eb 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -888,6 +888,7 @@ void CGameHandler::applyBattleEffects(BattleAttack &bat, const CStack *att, cons StacksHealedOrResurrected shi; shi.lifeDrain = true; shi.tentHealing = false; + shi.cure = false; shi.drainedFrom = def->ID; StacksHealedOrResurrected::HealInfo hi; @@ -4153,6 +4154,7 @@ bool CGameHandler::makeBattleAction( BattleAction &ba ) StacksHealedOrResurrected shr; shr.lifeDrain = false; shr.tentHealing = true; + shr.cure = false; shr.drainedFrom = ba.stackNumber; StacksHealedOrResurrected::HealInfo hi;