浏览代码

fixed http://bugs.vcmi.eu/view.php?id=2282

AlexVinS 9 年之前
父节点
当前提交
7874dffa7d
共有 4 个文件被更改,包括 17 次插入0 次删除
  1. 1 0
      lib/NetPacks.h
  2. 12 0
      lib/NetPacksLib.cpp
  3. 2 0
      lib/spells/BattleSpellMechanics.cpp
  4. 2 0
      server/CGameHandler.cpp

+ 1 - 0
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 lifeDrain; //if true, this heal is an effect of life drain
 	bool tentHealing; //if true, than it's healing via First Aid Tent
 	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
 	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 <typename Handler> void serialize(Handler &h, const int version)
 	template <typename Handler> void serialize(Handler &h, const int version)
 	{
 	{

+ 12 - 0
lib/NetPacksLib.cpp

@@ -1623,6 +1623,18 @@ DLL_LINKAGE void StacksHealedOrResurrected::applyGs( CGameState *gs )
 		}
 		}
 		vstd::amin(changedStack->firstHPleft, changedStack->MaxHealth());
 		vstd::amin(changedStack->firstHPleft, changedStack->MaxHealth());
 		if(resurrected)
 		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
 			//removing all effects from negative spells
 			auto selector = [](const Bonus * b)
 			auto selector = [](const Bonus * b)

+ 2 - 0
lib/spells/BattleSpellMechanics.cpp

@@ -24,6 +24,8 @@ void HealingSpellMechanics::applyBattleEffects(const SpellCastEnvironment * env,
 	StacksHealedOrResurrected shr;
 	StacksHealedOrResurrected shr;
 	shr.lifeDrain = false;
 	shr.lifeDrain = false;
 	shr.tentHealing = 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);
 	const bool resurrect = (healLevel != EHealLevel::HEAL);
 	for(auto & attackedCre : ctx.attackedCres)
 	for(auto & attackedCre : ctx.attackedCres)

+ 2 - 0
server/CGameHandler.cpp

@@ -888,6 +888,7 @@ void CGameHandler::applyBattleEffects(BattleAttack &bat, const CStack *att, cons
 		StacksHealedOrResurrected shi;
 		StacksHealedOrResurrected shi;
 		shi.lifeDrain = true;
 		shi.lifeDrain = true;
 		shi.tentHealing = false;
 		shi.tentHealing = false;
+		shi.cure = false;
 		shi.drainedFrom = def->ID;
 		shi.drainedFrom = def->ID;
 
 
 		StacksHealedOrResurrected::HealInfo hi;
 		StacksHealedOrResurrected::HealInfo hi;
@@ -4153,6 +4154,7 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
 				StacksHealedOrResurrected shr;
 				StacksHealedOrResurrected shr;
 				shr.lifeDrain = false;
 				shr.lifeDrain = false;
 				shr.tentHealing = true;
 				shr.tentHealing = true;
+				shr.cure = false;
 				shr.drainedFrom = ba.stackNumber;
 				shr.drainedFrom = ba.stackNumber;
 
 
 				StacksHealedOrResurrected::HealInfo hi;
 				StacksHealedOrResurrected::HealInfo hi;