diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java index 737173b4ba5..e4e861283ce 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/UndyingTest.java @@ -69,7 +69,7 @@ public class UndyingTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Last Gasp", "Elite Vanguard"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Undying Evil", "Elite Vanguard"); - setStopAt(1, PhaseStep.BEGIN_COMBAT); + setStopAt(1, PhaseStep.END_COMBAT); execute(); assertPermanentCount(playerA, "Elite Vanguard", 1); diff --git a/Mage/src/mage/abilities/TriggeredAbilities.java b/Mage/src/mage/abilities/TriggeredAbilities.java index 1140156f991..d01eff1e5f5 100644 --- a/Mage/src/mage/abilities/TriggeredAbilities.java +++ b/Mage/src/mage/abilities/TriggeredAbilities.java @@ -49,7 +49,7 @@ import mage.game.permanent.PermanentCard; */ public class TriggeredAbilities extends HashMap { - private Map> sources = new HashMap>(); + private final Map> sources = new HashMap<>(); public TriggeredAbilities() {} @@ -122,7 +122,7 @@ public class TriggeredAbilities extends HashMap { */ public void add(TriggeredAbility ability, UUID sourceId, MageObject attachedTo) { this.add(ability, attachedTo); - List uuidList = new LinkedList(); + List uuidList = new LinkedList<>(); uuidList.add(sourceId); // if the object that gained the ability moves zone, also then the triggered ability must be removed uuidList.add(attachedTo.getId()); @@ -145,9 +145,10 @@ public class TriggeredAbilities extends HashMap { * Removes gained abilities by sourceId * * @param sourceId + * @return */ public List removeGainedAbilitiesForSource(UUID sourceId) { - List keysToRemove = new ArrayList(); + List keysToRemove = new ArrayList<>(); for (Map.Entry> entry : sources.entrySet()) { if (entry.getValue().contains(sourceId)) { diff --git a/Mage/src/mage/game/permanent/PermanentCard.java b/Mage/src/mage/game/permanent/PermanentCard.java index 335a64f68a4..09c53cb4ff4 100644 --- a/Mage/src/mage/game/permanent/PermanentCard.java +++ b/Mage/src/mage/game/permanent/PermanentCard.java @@ -163,6 +163,7 @@ public class PermanentCard extends PermanentImpl { game.setZone(objectId, event.getToZone()); game.addSimultaneousEvent(event); if (event.getFromZone().equals(Zone.BATTLEFIELD)) { + game.getState().handleSimultaneousEvent(game); game.resetForSourceId(getId()); game.applyEffects(); // LevelX2: needed to execute isInactive for of custom duration copy effect if source returns directly (e.g. cloudshifted clone) }