Bläddra i källkod

Make pass/force action spells take effect immediately after being reflected on an active unit

Opuszek 3 månader sedan
förälder
incheckning
e9f0ffed88
1 ändrade filer med 9 tillägg och 3 borttagningar
  1. 9 3
      server/battles/BattleFlowProcessor.cpp

+ 9 - 3
server/battles/BattleFlowProcessor.cpp

@@ -616,10 +616,16 @@ void BattleFlowProcessor::onActionMade(const CBattleInfoCallback & battle, const
 	{
 		if (activeStack && activeStack->alive())
 		{
-			// this is action made by hero AND unit is alive (e.g. not killed by casted spell)
+			bool activeStackAffectedBySpell = !activeStack->canMove() ||
+					tryActivateBerserkPenalty(battle, battle.battleGetStackByID(battle.getBattle()->getActiveStackID()));
+
+			// this is action made by hero AND unit is neither killed nor affected by reflected spell like blind or berserk
 			// keep current active stack for next action
-			setActiveStack(battle, activeStack, BattleUnitTurnReason::HERO_SPELLCAST);
-			return;
+			if (!activeStackAffectedBySpell)
+			{
+				setActiveStack(battle, activeStack, BattleUnitTurnReason::HERO_SPELLCAST);
+				return;
+			}
 		}
 	}