From cbc949c08e7db8fcd91e0210bf383723391927fa Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 17 Apr 2021 12:13:37 -0400 Subject: [PATCH] removed deprecated method for adding delayed triggered abilities --- .../src/mage/cards/m/MilaCraftyCompanion.java | 2 +- Mage/src/main/java/mage/game/Game.java | 2 -- Mage/src/main/java/mage/game/GameImpl.java | 23 ++++++------------- .../main/java/mage/players/PlayerImpl.java | 2 +- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Mage.Sets/src/mage/cards/m/MilaCraftyCompanion.java b/Mage.Sets/src/mage/cards/m/MilaCraftyCompanion.java index 437655b059..8c91fdf913 100644 --- a/Mage.Sets/src/mage/cards/m/MilaCraftyCompanion.java +++ b/Mage.Sets/src/mage/cards/m/MilaCraftyCompanion.java @@ -203,7 +203,7 @@ class LukkaWaywardBonderReturnEffect extends OneShotEffect { .setText("Exile it at the beginning of your next upkeep.") .setTargetPointer(new FixedTarget(permanent, game)), Duration.Custom, true - )); + ), source); return true; } } diff --git a/Mage/src/main/java/mage/game/Game.java b/Mage/src/main/java/mage/game/Game.java index b7a6510200..af4ad622b3 100644 --- a/Mage/src/main/java/mage/game/Game.java +++ b/Mage/src/main/java/mage/game/Game.java @@ -425,8 +425,6 @@ public interface Game extends MageItem, Serializable { void addTriggeredAbility(TriggeredAbility ability, GameEvent triggeringEvent); - UUID addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility); - UUID addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility, Ability source); UUID fireReflexiveTriggeredAbility(ReflexiveTriggeredAbility reflexiveAbility, Ability source); diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 45d66188f0..0a9a6ea933 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -1778,25 +1778,16 @@ public abstract class GameImpl implements Game, Serializable { @Override public UUID addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility, Ability source) { - delayedAbility.setSourceId(source.getSourceId()); - delayedAbility.setControllerId(source.getControllerId()); + if (source != null) { + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(source.getControllerId()); + } // return addDelayedTriggeredAbility(delayedAbility); DelayedTriggeredAbility newAbility = delayedAbility.copy(); newAbility.newId(); - newAbility.setSourceObjectZoneChangeCounter(getState().getZoneChangeCounter(source.getSourceId())); - newAbility.initOnAdding(this); - // ability.init is called as the ability triggeres not now. - // If a FixedTarget pointer is already set from the effect setting up this delayed ability - // it has to be already initialized so it won't be overwitten as the ability triggers - getState().addDelayedTriggeredAbility(newAbility); - return newAbility.getId(); - } - - @Deprecated - @Override - public UUID addDelayedTriggeredAbility(DelayedTriggeredAbility delayedAbility) { - DelayedTriggeredAbility newAbility = delayedAbility.copy(); - newAbility.newId(); + if (source != null) { + newAbility.setSourceObjectZoneChangeCounter(getState().getZoneChangeCounter(source.getSourceId())); + } newAbility.initOnAdding(this); // ability.init is called as the ability triggeres not now. // If a FixedTarget pointer is already set from the effect setting up this delayed ability diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 8b5a8dd723..3ee256dbc2 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -553,7 +553,7 @@ public abstract class PlayerImpl implements Player, Serializable { new LoseControlOnOtherPlayersControllerEffect(this.getLogName(), player.getLogName())); ability.setSourceId(getId()); ability.setControllerId(getId()); - game.addDelayedTriggeredAbility(ability); + game.addDelayedTriggeredAbility(ability, null); } }