diff --git a/Mage.Sets/src/mage/cards/a/AngelOfDestiny.java b/Mage.Sets/src/mage/cards/a/AngelOfDestiny.java index bf0df6ed71b..3e97627ad2c 100644 --- a/Mage.Sets/src/mage/cards/a/AngelOfDestiny.java +++ b/Mage.Sets/src/mage/cards/a/AngelOfDestiny.java @@ -114,7 +114,7 @@ class AngelOfDestinyLoseEffect extends OneShotEffect { return false; } Set playerSet = watcher.getPlayers(new MageObjectReference( - source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game + source.getSourceId(), source.getStackMomentSourceZCC(), game )); if (playerSet == null) { return false; diff --git a/Mage.Sets/src/mage/cards/a/AshioksErasure.java b/Mage.Sets/src/mage/cards/a/AshioksErasure.java index a8a4273cb13..4033aad9e33 100644 --- a/Mage.Sets/src/mage/cards/a/AshioksErasure.java +++ b/Mage.Sets/src/mage/cards/a/AshioksErasure.java @@ -90,7 +90,7 @@ class AshioksErasureExileEffect extends OneShotEffect { || spell == null) { return false; } - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); return controller.moveCardsToExile(spell, source, game, true, exileId, sourceObject.getIdName()); } } @@ -126,7 +126,7 @@ class AshioksErasureReplacementEffect extends ContinuousRuleModifyingEffectImpl || card == null) { return false; } - UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); ExileZone exile = game.getExile().getExileZone(exileZone); if (exile == null) { diff --git a/Mage.Sets/src/mage/cards/a/AuratouchedMage.java b/Mage.Sets/src/mage/cards/a/AuratouchedMage.java index 1a06f66a7e8..17c958cf8b0 100644 --- a/Mage.Sets/src/mage/cards/a/AuratouchedMage.java +++ b/Mage.Sets/src/mage/cards/a/AuratouchedMage.java @@ -73,7 +73,7 @@ class AuratouchedMageEffect extends OneShotEffect { Card aura = game.getCard(target.getFirstTarget()); Permanent auratouchedMage = source.getSourcePermanentIfItStillExists(game); if (aura != null && auratouchedMage != null - && game.getState().getZoneChangeCounter(source.getSourceId()) == source.getSourceObjectZoneChangeCounter()) { + && game.getState().getZoneChangeCounter(source.getSourceId()) == source.getStackMomentSourceZCC()) { game.getState().setValue("attachTo:" + aura.getId(), auratouchedMage); if (controller.moveCards(aura, Zone.BATTLEFIELD, source, game)) { auratouchedMage.addAttachment(aura.getId(), source, game); diff --git a/Mage.Sets/src/mage/cards/b/BagOfHolding.java b/Mage.Sets/src/mage/cards/b/BagOfHolding.java index 5b56b21b6fe..8705dc5cdd4 100644 --- a/Mage.Sets/src/mage/cards/b/BagOfHolding.java +++ b/Mage.Sets/src/mage/cards/b/BagOfHolding.java @@ -111,7 +111,7 @@ class BagOfHoldingReturnCardsEffect extends OneShotEffect { return false; } ExileZone exileZone = game.getExile().getExileZone( - CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()) + CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()) ); if (exileZone == null) { return true; diff --git a/Mage.Sets/src/mage/cards/b/BeamsplitterMage.java b/Mage.Sets/src/mage/cards/b/BeamsplitterMage.java index 1bdb93421cf..e1282b210d6 100644 --- a/Mage.Sets/src/mage/cards/b/BeamsplitterMage.java +++ b/Mage.Sets/src/mage/cards/b/BeamsplitterMage.java @@ -121,11 +121,11 @@ class BeamsplitterMageTriggeredAbility extends TriggeredAbilityImpl { private boolean checkNotSource(Permanent permanent, Game game) { // workaround for zcc not being set before first intervening if check - if (this.getSourceObjectZoneChangeCounter() == 0) { + if (this.getStackMomentSourceZCC() == 0) { return !permanent.getId().equals(this.getSourceId()); } return !permanent.getId().equals(this.getSourceId()) - || permanent.getZoneChangeCounter(game) != this.getSourceObjectZoneChangeCounter(); + || permanent.getZoneChangeCounter(game) != this.getStackMomentSourceZCC(); } @Override diff --git a/Mage.Sets/src/mage/cards/b/BishopOfBinding.java b/Mage.Sets/src/mage/cards/b/BishopOfBinding.java index cdfe4492213..df6167235e0 100644 --- a/Mage.Sets/src/mage/cards/b/BishopOfBinding.java +++ b/Mage.Sets/src/mage/cards/b/BishopOfBinding.java @@ -18,13 +18,11 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.SubType; -import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; import mage.game.ExileZone; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; -import mage.target.common.TargetCreaturePermanent; import mage.util.CardUtil; import static mage.filter.StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE; @@ -87,7 +85,7 @@ class BishopOfBindingExileEffect extends OneShotEffect { // the target creature won't be exiled. if (permanent != null) { new ExileTargetEffect( - CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), permanent.getIdName() + CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()), permanent.getIdName() ).apply(game, source); game.addDelayedTriggeredAbility(new OnLeaveReturnExiledAbility(), source); return true; @@ -101,7 +99,7 @@ enum BishopOfBindingValue implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, sourceAbility.getSourceId(), sourceAbility.getSourceObjectZoneChangeCounter())); + ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, sourceAbility.getSourceId(), sourceAbility.getStackMomentSourceZCC())); if (exileZone != null) { Card exiledCard = exileZone.getRandom(game); if (exiledCard != null) { diff --git a/Mage.Sets/src/mage/cards/b/BlazingEffigy.java b/Mage.Sets/src/mage/cards/b/BlazingEffigy.java index c64d4e9826f..4723a25efcc 100644 --- a/Mage.Sets/src/mage/cards/b/BlazingEffigy.java +++ b/Mage.Sets/src/mage/cards/b/BlazingEffigy.java @@ -59,7 +59,7 @@ enum BlazingEffigyCount implements DynamicValue { if (watcher == null) { return 3; } - int effigyDamage = watcher.damageDoneTo(sourceAbility.getSourceId(), sourceAbility.getSourceObjectZoneChangeCounter() - 1, game); + int effigyDamage = watcher.damageDoneTo(sourceAbility.getSourceId(), sourceAbility.getStackMomentSourceZCC() - 1, game); return CardUtil.overflowInc(3, effigyDamage); } diff --git a/Mage.Sets/src/mage/cards/b/BogardanPhoenix.java b/Mage.Sets/src/mage/cards/b/BogardanPhoenix.java index 4e7eb4308e6..7bd42f29c23 100644 --- a/Mage.Sets/src/mage/cards/b/BogardanPhoenix.java +++ b/Mage.Sets/src/mage/cards/b/BogardanPhoenix.java @@ -74,11 +74,11 @@ class BogardanPhoenixEffect extends OneShotEffect { if (permanent == null || controller == null || permanent.getZoneChangeCounter(game) + 1 - != source.getSourceObjectZoneChangeCounter()) { + != source.getStackMomentSourceZCC()) { return false; } Card card = game.getCard(permanent.getId()); - if (card == null || card.getZoneChangeCounter(game) != source.getSourceObjectZoneChangeCounter()) { + if (card == null || card.getZoneChangeCounter(game) != source.getStackMomentSourceZCC()) { return false; } if (permanent.getCounters(game).containsKey(CounterType.DEATH)) { diff --git a/Mage.Sets/src/mage/cards/c/CemeteryGatekeeper.java b/Mage.Sets/src/mage/cards/c/CemeteryGatekeeper.java index cfc09b66f3c..9ec04a37b8b 100644 --- a/Mage.Sets/src/mage/cards/c/CemeteryGatekeeper.java +++ b/Mage.Sets/src/mage/cards/c/CemeteryGatekeeper.java @@ -86,7 +86,7 @@ class CemeteryGatekeeperEffect extends OneShotEffect { controller.choose(outcome, target, source, game); Card card = game.getCard(target.getFirstTarget()); if (card != null) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); MageObject sourceObject = source.getSourceObject(game); String exileName = sourceObject == null ? null : sourceObject.getIdName(); return controller.moveCardsToExile(card, source, game, true, exileId, exileName); diff --git a/Mage.Sets/src/mage/cards/c/CemeteryIlluminator.java b/Mage.Sets/src/mage/cards/c/CemeteryIlluminator.java index 31ffac3f823..550529caeb5 100644 --- a/Mage.Sets/src/mage/cards/c/CemeteryIlluminator.java +++ b/Mage.Sets/src/mage/cards/c/CemeteryIlluminator.java @@ -92,7 +92,7 @@ class CemeteryIlluminatorExileEffect extends OneShotEffect { controller.choose(outcome, target, source, game); Card card = game.getCard(target.getFirstTarget()); if (card != null) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); MageObject sourceObject = source.getSourceObject(game); String exileName = sourceObject == null ? null : sourceObject.getIdName(); return controller.moveCardsToExile(card, source, game, true, exileId, exileName); diff --git a/Mage.Sets/src/mage/cards/c/CemeteryProtector.java b/Mage.Sets/src/mage/cards/c/CemeteryProtector.java index 199dd0cf567..8c7cb4a13d1 100644 --- a/Mage.Sets/src/mage/cards/c/CemeteryProtector.java +++ b/Mage.Sets/src/mage/cards/c/CemeteryProtector.java @@ -87,7 +87,7 @@ class CemeteryProtectorEffect extends OneShotEffect { controller.choose(outcome, target, source, game); Card card = game.getCard(target.getFirstTarget()); if (card != null) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); MageObject sourceObject = source.getSourceObject(game); String exileName = sourceObject == null ? null : sourceObject.getIdName(); return controller.moveCardsToExile(card, source, game, true, exileId, exileName); diff --git a/Mage.Sets/src/mage/cards/c/CemeteryProwler.java b/Mage.Sets/src/mage/cards/c/CemeteryProwler.java index 835e90b1c21..5df6f0900e6 100644 --- a/Mage.Sets/src/mage/cards/c/CemeteryProwler.java +++ b/Mage.Sets/src/mage/cards/c/CemeteryProwler.java @@ -79,7 +79,7 @@ class CemeteryProwlerExileEffect extends OneShotEffect { controller.choose(outcome, target, source, game); Card card = game.getCard(target.getFirstTarget()); if (card != null) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); MageObject sourceObject = source.getSourceObject(game); String exileName = sourceObject == null ? null : sourceObject.getIdName(); return controller.moveCardsToExile(card, source, game, true, exileId, exileName); diff --git a/Mage.Sets/src/mage/cards/c/ChainerNightmareAdept.java b/Mage.Sets/src/mage/cards/c/ChainerNightmareAdept.java index 95111180226..9a31aa06474 100644 --- a/Mage.Sets/src/mage/cards/c/ChainerNightmareAdept.java +++ b/Mage.Sets/src/mage/cards/c/ChainerNightmareAdept.java @@ -141,14 +141,14 @@ class ChainerNightmareAdeptWatcher extends Watcher { return false; } MageObjectReference mor = new MageObjectReference( - source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game + source.getSourceId(), source.getStackMomentSourceZCC(), game ); return morMap.computeIfAbsent(mor, m -> new HashMap<>()).getOrDefault(playerId, 0) > 0; } void addPlayable(Ability source, Game game) { MageObjectReference mor = new MageObjectReference( - source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game + source.getSourceId(), source.getStackMomentSourceZCC(), game ); morMap.computeIfAbsent(mor, m -> new HashMap<>()) .compute(source.getControllerId(), CardUtil::setOrIncrementValue); diff --git a/Mage.Sets/src/mage/cards/c/ChandraDressedToKill.java b/Mage.Sets/src/mage/cards/c/ChandraDressedToKill.java index ed2fd8e518e..a80ea00f467 100644 --- a/Mage.Sets/src/mage/cards/c/ChandraDressedToKill.java +++ b/Mage.Sets/src/mage/cards/c/ChandraDressedToKill.java @@ -97,7 +97,7 @@ class ChandraDressedToKillExile1Effect extends OneShotEffect { if (card == null) { return false; } - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); MageObject sourceObject = source.getSourceObject(game); String exileName = sourceObject == null ? null : sourceObject.getIdName(); controller.moveCardsToExile(card, source, game, true, exileId, exileName); @@ -135,7 +135,7 @@ class ChandraDressedToKillExile5Effect extends OneShotEffect { if (cards.isEmpty()) { return false; } - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); MageObject sourceObject = source.getSourceObject(game); String exileName = sourceObject == null ? null : sourceObject.getIdName(); controller.moveCardsToExile(cards, source, game, true, exileId, exileName); diff --git a/Mage.Sets/src/mage/cards/c/ClockworkBeetle.java b/Mage.Sets/src/mage/cards/c/ClockworkBeetle.java index e513d181cb4..54c08ad4fb0 100644 --- a/Mage.Sets/src/mage/cards/c/ClockworkBeetle.java +++ b/Mage.Sets/src/mage/cards/c/ClockworkBeetle.java @@ -66,7 +66,7 @@ class ClockworkBeetleEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { Effect effect = new RemoveCounterTargetEffect(CounterType.P1P1.createInstance()); - effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter())); + effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getStackMomentSourceZCC())); game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(effect), source); return true; } diff --git a/Mage.Sets/src/mage/cards/c/CorrosiveOoze.java b/Mage.Sets/src/mage/cards/c/CorrosiveOoze.java index 2979160128e..d06923b0a46 100644 --- a/Mage.Sets/src/mage/cards/c/CorrosiveOoze.java +++ b/Mage.Sets/src/mage/cards/c/CorrosiveOoze.java @@ -79,7 +79,7 @@ class CorrosiveOozeEffect extends OneShotEffect { if (watcher == null) { return false; } - MageObjectReference sourceMor = new MageObjectReference(source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game); + MageObjectReference sourceMor = new MageObjectReference(source.getSourceId(), source.getStackMomentSourceZCC(), game); List equipments = watcher.getEquipmentsToDestroy(sourceMor) .stream() .map(mor -> mor.getPermanent(game)) diff --git a/Mage.Sets/src/mage/cards/c/CustodyBattle.java b/Mage.Sets/src/mage/cards/c/CustodyBattle.java index 8ff892631d4..4b2a3f30eb1 100644 --- a/Mage.Sets/src/mage/cards/c/CustodyBattle.java +++ b/Mage.Sets/src/mage/cards/c/CustodyBattle.java @@ -131,7 +131,7 @@ class CustodyBattleUnlessPaysEffect extends OneShotEffect { return true; } } - if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()) + if (source.getStackMomentSourceZCC() == game.getState().getZoneChangeCounter(source.getSourceId()) && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) { ContinuousEffect effect = new GiveControlEffect(); effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game)); diff --git a/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java b/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java index 2de29c123d3..ad96ccb040e 100644 --- a/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java +++ b/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java @@ -147,7 +147,7 @@ class CyclopeanTombEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - MageObjectReference mor = new MageObjectReference(source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game); + MageObjectReference mor = new MageObjectReference(source.getSourceId(), source.getStackMomentSourceZCC(), game); CyclopeanTombCounterWatcher watcher = game.getState().getWatcher(CyclopeanTombCounterWatcher.class); if (controller != null && watcher != null) { diff --git a/Mage.Sets/src/mage/cards/d/DampingEngine.java b/Mage.Sets/src/mage/cards/d/DampingEngine.java index d298afd4fd0..20d92803bfb 100644 --- a/Mage.Sets/src/mage/cards/d/DampingEngine.java +++ b/Mage.Sets/src/mage/cards/d/DampingEngine.java @@ -78,7 +78,7 @@ public class DampingEngine extends CardImpl { return "dampingEngine_" + playerId + "_" + source.getSourceId() + "_" - + source.getSourceObjectZoneChangeCounter() + "_" + + source.getStackMomentSourceZCC() + "_" + game.getTurnNum(); } diff --git a/Mage.Sets/src/mage/cards/d/DayOfTheDragons.java b/Mage.Sets/src/mage/cards/d/DayOfTheDragons.java index 660d41a4655..791ea5f5ba7 100644 --- a/Mage.Sets/src/mage/cards/d/DayOfTheDragons.java +++ b/Mage.Sets/src/mage/cards/d/DayOfTheDragons.java @@ -78,7 +78,7 @@ class DayOfTheDragonsEntersEffect extends OneShotEffect { Set toExile = new HashSet<>(); toExile.addAll(game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)); if (!toExile.isEmpty()) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); controller.moveCardsToExile(toExile, source, game, true, exileId, sourceObject.getIdName()); DragonToken2 token = new DragonToken2(); token.putOntoBattlefield(toExile.size(), game, source, source.getControllerId()); @@ -110,7 +110,7 @@ class DayOfTheDragonsLeavesEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null) { - int zoneChangeCounter = source.getSourceObjectZoneChangeCounter(); + int zoneChangeCounter = source.getStackMomentSourceZCC(); if (zoneChangeCounter > 0 && !(sourceObject instanceof PermanentToken)) { zoneChangeCounter--; } diff --git a/Mage.Sets/src/mage/cards/d/DayOfTheMoon.java b/Mage.Sets/src/mage/cards/d/DayOfTheMoon.java index a5d100572d2..f5e39a65e3e 100644 --- a/Mage.Sets/src/mage/cards/d/DayOfTheMoon.java +++ b/Mage.Sets/src/mage/cards/d/DayOfTheMoon.java @@ -101,7 +101,7 @@ class DayOfTheMoonEffect extends OneShotEffect { } private static List getOrSetValue(Game game, Ability source) { - String key = "DayOfTheMoon_" + source.getControllerId() + '_' + source.getSourceObjectZoneChangeCounter(); + String key = "DayOfTheMoon_" + source.getControllerId() + '_' + source.getStackMomentSourceZCC(); List list = (List) game.getState().getValue(key); if (list != null) { return list; diff --git a/Mage.Sets/src/mage/cards/d/DetentionSphere.java b/Mage.Sets/src/mage/cards/d/DetentionSphere.java index c16dc102058..4238b79c43e 100644 --- a/Mage.Sets/src/mage/cards/d/DetentionSphere.java +++ b/Mage.Sets/src/mage/cards/d/DetentionSphere.java @@ -74,7 +74,7 @@ class DetentionSphereEntersEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/d/DragonWhelp.java b/Mage.Sets/src/mage/cards/d/DragonWhelp.java index 3d721f6e9c9..f30efb7ff6a 100644 --- a/Mage.Sets/src/mage/cards/d/DragonWhelp.java +++ b/Mage.Sets/src/mage/cards/d/DragonWhelp.java @@ -19,7 +19,6 @@ import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Duration; import mage.constants.Outcome; -import mage.constants.Zone; import mage.game.Game; /** @@ -74,7 +73,7 @@ class DragonWhelpEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getStackMomentSourceZCC()); activationInfo.addActivation(game); if (activationInfo.getActivationCounter() >= 4) { DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeSourceEffect()); diff --git a/Mage.Sets/src/mage/cards/d/DralnusPet.java b/Mage.Sets/src/mage/cards/d/DralnusPet.java index 20979c4cffa..d3daea9aa08 100644 --- a/Mage.Sets/src/mage/cards/d/DralnusPet.java +++ b/Mage.Sets/src/mage/cards/d/DralnusPet.java @@ -92,7 +92,7 @@ class DralnusPetEffect extends OneShotEffect { SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); if (spellAbility != null && spellAbility.getSourceId().equals(source.getSourceId()) - && permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) { + && permanent.getZoneChangeCounter(game) == spellAbility.getStackMomentSourceZCC()) { int cmc = 0; for (Cost cost : spellAbility.getCosts()) { if (cost instanceof DiscardCardCost && !((DiscardCardCost) cost).getCards().isEmpty()) { diff --git a/Mage.Sets/src/mage/cards/d/DurkwoodTracker.java b/Mage.Sets/src/mage/cards/d/DurkwoodTracker.java index 83f1f8de7db..1fdac9d4f5c 100644 --- a/Mage.Sets/src/mage/cards/d/DurkwoodTracker.java +++ b/Mage.Sets/src/mage/cards/d/DurkwoodTracker.java @@ -70,7 +70,7 @@ class DurkwoodTrackerEffect extends OneShotEffect { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null || permanent.getZoneChangeCounter(game) - != source.getSourceObjectZoneChangeCounter()) { + != source.getStackMomentSourceZCC()) { return false; } Permanent targeted = game.getPermanent(source.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/e/EmberwildeDjinn.java b/Mage.Sets/src/mage/cards/e/EmberwildeDjinn.java index 027f7e47f62..981cd9ed20b 100644 --- a/Mage.Sets/src/mage/cards/e/EmberwildeDjinn.java +++ b/Mage.Sets/src/mage/cards/e/EmberwildeDjinn.java @@ -82,7 +82,7 @@ class EmberwildeDjinnEffect extends OneShotEffect { if (player.chooseUse(Outcome.GainControl, "Gain control of " + sourceObject.getLogName() + "?", source, game)) { if (cost.pay(source, game, source, player.getId(), false)) { ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, false, player.getId()); - effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter())); + effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getStackMomentSourceZCC())); game.addEffect(effect, source); player.resetStoredBookmark(game); } diff --git a/Mage.Sets/src/mage/cards/f/FaerieArtisans.java b/Mage.Sets/src/mage/cards/f/FaerieArtisans.java index f5038d7fb81..437a27bfa0c 100644 --- a/Mage.Sets/src/mage/cards/f/FaerieArtisans.java +++ b/Mage.Sets/src/mage/cards/f/FaerieArtisans.java @@ -77,7 +77,7 @@ class FaerieArtisansEffect extends OneShotEffect { CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(null, CardType.ARTIFACT, false); effect.setTargetPointer(new FixedTarget(permanentToCopy, game)); if (effect.apply(game, source)) { - String oldTokens = (String) game.getState().getValue(source.getSourceId().toString() + source.getSourceObjectZoneChangeCounter()); + String oldTokens = (String) game.getState().getValue(source.getSourceId().toString() + source.getStackMomentSourceZCC()); StringBuilder sb = new StringBuilder(); for (Permanent permanent : effect.getAddedPermanents()) { if (sb.length() > 0) { @@ -85,7 +85,7 @@ class FaerieArtisansEffect extends OneShotEffect { } sb.append(permanent.getId()); } - game.getState().setValue(source.getSourceId().toString() + source.getSourceObjectZoneChangeCounter(), sb.toString()); + game.getState().setValue(source.getSourceId().toString() + source.getStackMomentSourceZCC(), sb.toString()); if (oldTokens != null) { Cards cards = new CardsImpl(); diff --git a/Mage.Sets/src/mage/cards/f/FarrelitePriest.java b/Mage.Sets/src/mage/cards/f/FarrelitePriest.java index e7fb0bd4d6a..3c234f51959 100644 --- a/Mage.Sets/src/mage/cards/f/FarrelitePriest.java +++ b/Mage.Sets/src/mage/cards/f/FarrelitePriest.java @@ -67,7 +67,7 @@ class FarrelitePriestEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getStackMomentSourceZCC()); activationInfo.addActivation(game); if (activationInfo.getActivationCounter() == 4) { DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeSourceEffect()); diff --git a/Mage.Sets/src/mage/cards/f/FuriousRise.java b/Mage.Sets/src/mage/cards/f/FuriousRise.java index 76265389d70..9143c5fb65e 100644 --- a/Mage.Sets/src/mage/cards/f/FuriousRise.java +++ b/Mage.Sets/src/mage/cards/f/FuriousRise.java @@ -72,7 +72,7 @@ class FuriousRiseEffect extends OneShotEffect { Card cardToExile = controller.getLibrary().getFromTop(game); UUID exileId = CardUtil.getCardExileZoneId(game, source); - controller.moveCardsToExile(cardToExile, source, game, true, exileId, mageObject.getIdName() + " (" + source.getSourceObjectZoneChangeCounter() + ")"); + controller.moveCardsToExile(cardToExile, source, game, true, exileId, mageObject.getIdName() + " (" + source.getStackMomentSourceZCC() + ")"); Card cardToPlay = game.getCard(cardToExile.getId()); endPreviousEffect(game, source); // workaround for Furious Rise @@ -90,7 +90,7 @@ class FuriousRiseEffect extends OneShotEffect { if (effect instanceof FuriousRisePlayEffect) { for (Ability ability : game.getContinuousEffects().getAsThoughEffectsAbility(effect)) { if (ability.getSourceId().equals(source.getSourceId()) - && source.getSourceObjectZoneChangeCounter() == ability.getSourceObjectZoneChangeCounter()) { + && source.getStackMomentSourceZCC() == ability.getStackMomentSourceZCC()) { effect.discard(); return true; } diff --git a/Mage.Sets/src/mage/cards/g/GOTOJAIL.java b/Mage.Sets/src/mage/cards/g/GOTOJAIL.java index 730b6accdfe..78ad6c1b278 100644 --- a/Mage.Sets/src/mage/cards/g/GOTOJAIL.java +++ b/Mage.Sets/src/mage/cards/g/GOTOJAIL.java @@ -13,13 +13,11 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Zone; -import mage.filter.StaticFilters; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; -import mage.target.common.TargetCreaturePermanent; import mage.util.CardUtil; import java.util.List; @@ -82,7 +80,7 @@ class GoToJailExileEffect extends OneShotEffect { if (controller != null) { game.getState().setValue(permanent.getId() + ChooseOpponentEffect.VALUE_KEY, controller.getId()); new ExileTargetEffect( - CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), permanent.getIdName() + CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()), permanent.getIdName() ).apply(game, source); game.addDelayedTriggeredAbility(new OnLeaveReturnExiledAbility(), source); return true; diff --git a/Mage.Sets/src/mage/cards/g/GarthOneEye.java b/Mage.Sets/src/mage/cards/g/GarthOneEye.java index 4a2b385deeb..77fc0c215a2 100644 --- a/Mage.Sets/src/mage/cards/g/GarthOneEye.java +++ b/Mage.Sets/src/mage/cards/g/GarthOneEye.java @@ -140,7 +140,7 @@ class GarthOneEyeEffect extends OneShotEffect { static final String getKey(Ability source) { return source.getSourceId() + "_" - + source.getSourceObjectZoneChangeCounter() + "_" + + source.getStackMomentSourceZCC() + "_" + source.getOriginalId() + "_garth"; } } diff --git a/Mage.Sets/src/mage/cards/g/Ghostway.java b/Mage.Sets/src/mage/cards/g/Ghostway.java index cd3e87eed23..f26f40f3469 100644 --- a/Mage.Sets/src/mage/cards/g/Ghostway.java +++ b/Mage.Sets/src/mage/cards/g/Ghostway.java @@ -67,7 +67,7 @@ class GhostwayEffect extends OneShotEffect { if (sourceObject != null && controller != null) { Set toExile = new HashSet<>(); toExile.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)); - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); controller.moveCardsToExile(toExile, source, game, true, exileId, sourceObject.getIdName()); Cards cardsToReturn = new CardsImpl(); diff --git a/Mage.Sets/src/mage/cards/g/GloriousProtector.java b/Mage.Sets/src/mage/cards/g/GloriousProtector.java index f667a959a5e..77eadff6410 100644 --- a/Mage.Sets/src/mage/cards/g/GloriousProtector.java +++ b/Mage.Sets/src/mage/cards/g/GloriousProtector.java @@ -100,7 +100,7 @@ class GloriousProtectorEffect extends OneShotEffect { player.moveCardsToExile( new CardsImpl(target.getTargets()).getCards(game), source, game, true, CardUtil.getExileZoneId( - game, source.getSourceId(), source.getSourceObjectZoneChangeCounter() + game, source.getSourceId(), source.getStackMomentSourceZCC() ), sourceObject.getIdName() ); game.addDelayedTriggeredAbility(new OnLeaveReturnExiledAbility(), source); diff --git a/Mage.Sets/src/mage/cards/g/GontiNightMinister.java b/Mage.Sets/src/mage/cards/g/GontiNightMinister.java index 365c57648ff..af7783794e0 100644 --- a/Mage.Sets/src/mage/cards/g/GontiNightMinister.java +++ b/Mage.Sets/src/mage/cards/g/GontiNightMinister.java @@ -12,7 +12,6 @@ import mage.cards.Card; import mage.constants.*; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.filter.FilterSpell; import mage.game.Game; import mage.game.events.DamagedEvent; import mage.game.events.GameEvent; @@ -152,7 +151,7 @@ class GontiExileEffect extends OneShotEffect { if (card == null) { return false; } - UUID exileZoneId = CardUtil.getExileZoneId(game, controller.getId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZoneId = CardUtil.getExileZoneId(game, controller.getId(), source.getStackMomentSourceZCC()); String exileName = CardUtil.getSourceName(game, source) + " - " + controller.getName(); if (controller.moveCardsToExile(card, source, game, false, exileZoneId, exileName)) { card.setFaceDown(true, game); diff --git a/Mage.Sets/src/mage/cards/g/GorexTheTombshell.java b/Mage.Sets/src/mage/cards/g/GorexTheTombshell.java index 691fac1f249..5f3ccc7a9c1 100644 --- a/Mage.Sets/src/mage/cards/g/GorexTheTombshell.java +++ b/Mage.Sets/src/mage/cards/g/GorexTheTombshell.java @@ -135,11 +135,11 @@ class GorexTheTombshellReturnEffect extends OneShotEffect { // relative zcc depends on object zone (battlefield for attacks trigger, graveyard for dies) // so try both zcc offsets to find zone ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId( - game, source.getSourceId(), source.getSourceObjectZoneChangeCounter() - 1 + game, source.getSourceId(), source.getStackMomentSourceZCC() - 1 )); if (exileZone == null || exileZone.isEmpty()) { exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId( - game, source.getSourceId(), source.getSourceObjectZoneChangeCounter() - 2 + game, source.getSourceId(), source.getStackMomentSourceZCC() - 2 )); if (exileZone == null || exileZone.isEmpty()) { return false; diff --git a/Mage.Sets/src/mage/cards/g/GrimoireThief.java b/Mage.Sets/src/mage/cards/g/GrimoireThief.java index e521250b5e0..18e81ea55b2 100644 --- a/Mage.Sets/src/mage/cards/g/GrimoireThief.java +++ b/Mage.Sets/src/mage/cards/g/GrimoireThief.java @@ -90,7 +90,7 @@ class GrimoireThiefExileEffect extends OneShotEffect { card.setFaceDown(true, game); } UUID exileZoneId = CardUtil.getExileZoneId(game, - source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + source.getSourceId(), source.getStackMomentSourceZCC()); targetOpponent.moveCardsToExile(cards, source, game, false, exileZoneId, sourceObject.getIdName()); for (Card card : cards) { diff --git a/Mage.Sets/src/mage/cards/g/GrothamaAllDevouring.java b/Mage.Sets/src/mage/cards/g/GrothamaAllDevouring.java index 76598f8f73e..7830b4f8fe0 100644 --- a/Mage.Sets/src/mage/cards/g/GrothamaAllDevouring.java +++ b/Mage.Sets/src/mage/cards/g/GrothamaAllDevouring.java @@ -19,7 +19,6 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.WatcherScope; -import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.AnotherPredicate; import mage.game.Game; @@ -152,7 +151,7 @@ class GrothamaAllDevouringDrawCardsEffect extends OneShotEffect { if (watcher == null) { return false; } - Map damageMap = watcher.getDamageMap(new MageObjectReference(source.getSourceId(), source.getSourceObjectZoneChangeCounter() - 1, game)); + Map damageMap = watcher.getDamageMap(new MageObjectReference(source.getSourceId(), source.getStackMomentSourceZCC() - 1, game)); for (UUID playerId : game.getPlayerList()) { Player player = game.getPlayer(playerId); if (player != null) { diff --git a/Mage.Sets/src/mage/cards/h/HaktosTheUnscarred.java b/Mage.Sets/src/mage/cards/h/HaktosTheUnscarred.java index 170498ae371..dc4c3aebd73 100644 --- a/Mage.Sets/src/mage/cards/h/HaktosTheUnscarred.java +++ b/Mage.Sets/src/mage/cards/h/HaktosTheUnscarred.java @@ -95,7 +95,7 @@ class HaktosTheUnscarredChooseEffect extends OneShotEffect { } int number = 2 + RandomUtil.nextInt(3); game.informPlayers(permanent.getLogName() + ": " + controller.getLogName() + " has chosen " + number + " at random"); - game.getState().setValue(permanent.getId() + "" + source.getSourceObjectZoneChangeCounter() + "_haktos_number", number); + game.getState().setValue(permanent.getId() + "" + source.getStackMomentSourceZCC() + "_haktos_number", number); permanent.addInfo("chosen number", CardUtil.addToolTipMarkTags("Chosen number: " + number), game); return true; } diff --git a/Mage.Sets/src/mage/cards/h/HaukensInsight.java b/Mage.Sets/src/mage/cards/h/HaukensInsight.java index 19b896ecdd0..d2b944a5f9e 100644 --- a/Mage.Sets/src/mage/cards/h/HaukensInsight.java +++ b/Mage.Sets/src/mage/cards/h/HaukensInsight.java @@ -80,7 +80,7 @@ class HaukensInsightExileEffect extends OneShotEffect { if (controller != null) { Card card = controller.getLibrary().getFromTop(game); if (card != null) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); MageObject sourceObject = source.getSourceObject(game); String exileName = sourceObject == null ? null : sourceObject.getIdName(); card.setFaceDown(true, game); diff --git a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java index 34598fa9a96..8daafe3625b 100644 --- a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java +++ b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java @@ -164,7 +164,7 @@ class HopeOfGhirapurCombatDamageWatcher extends Watcher { MageObjectReference mor; if (stackObject instanceof StackAbility) { // This is neccessary because the source object was sacrificed as cost and the correct zone change counter for target calid check can only be get from stack - mor = new MageObjectReference(objectId, ((StackAbility) stackObject).getSourceObjectZoneChangeCounter(), game); + mor = new MageObjectReference(objectId, ((StackAbility) stackObject).getStackMomentSourceZCC(), game); } else { mor = new MageObjectReference(objectId, game); } diff --git a/Mage.Sets/src/mage/cards/i/InfectiousRage.java b/Mage.Sets/src/mage/cards/i/InfectiousRage.java index ecf4aba4374..b341977041e 100644 --- a/Mage.Sets/src/mage/cards/i/InfectiousRage.java +++ b/Mage.Sets/src/mage/cards/i/InfectiousRage.java @@ -83,7 +83,7 @@ class InfectiousRageReattachEffect extends OneShotEffect { if (controller == null || auraCard == null) { return false; } - if (source.getSourceObjectZoneChangeCounter() != auraCard.getZoneChangeCounter(game)) { + if (source.getStackMomentSourceZCC() != auraCard.getZoneChangeCounter(game)) { return false; } diff --git a/Mage.Sets/src/mage/cards/i/InitiatesOfTheEbonHand.java b/Mage.Sets/src/mage/cards/i/InitiatesOfTheEbonHand.java index 408079e1561..3136d4bfa93 100644 --- a/Mage.Sets/src/mage/cards/i/InitiatesOfTheEbonHand.java +++ b/Mage.Sets/src/mage/cards/i/InitiatesOfTheEbonHand.java @@ -66,7 +66,7 @@ class InitiatesOfTheEbonHandEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getStackMomentSourceZCC()); activationInfo.addActivation(game); if (activationInfo.getActivationCounter() == 4) { DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeSourceEffect()); diff --git a/Mage.Sets/src/mage/cards/i/InkTreaderNephilim.java b/Mage.Sets/src/mage/cards/i/InkTreaderNephilim.java index 9f584c8820d..e6122255b1d 100644 --- a/Mage.Sets/src/mage/cards/i/InkTreaderNephilim.java +++ b/Mage.Sets/src/mage/cards/i/InkTreaderNephilim.java @@ -99,8 +99,8 @@ class InkTreaderNephilimTriggeredAbility extends TriggeredAbilityImpl { if (permanent == null || !permanent.getId().equals(getSourceId())) { return false; } - if (getSourceObjectZoneChangeCounter() != 0 - && getSourceObjectZoneChangeCounter() != permanent.getZoneChangeCounter(game)) { + if (getStackMomentSourceZCC() != 0 + && getStackMomentSourceZCC() != permanent.getZoneChangeCounter(game)) { return false; } flag = true; diff --git a/Mage.Sets/src/mage/cards/i/IntellectDevourer.java b/Mage.Sets/src/mage/cards/i/IntellectDevourer.java index b6bd578112e..1e84ac9092f 100644 --- a/Mage.Sets/src/mage/cards/i/IntellectDevourer.java +++ b/Mage.Sets/src/mage/cards/i/IntellectDevourer.java @@ -187,7 +187,7 @@ class IntellectDevourerReturnExiledCardEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (sourceObject != null && controller != null) { - ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter())); + ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC())); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (exile != null && sourcePermanent != null) { controller.moveCards(exile, Zone.HAND, source, game); diff --git a/Mage.Sets/src/mage/cards/i/IxalansBinding.java b/Mage.Sets/src/mage/cards/i/IxalansBinding.java index 76da782b496..3f80cd14da5 100644 --- a/Mage.Sets/src/mage/cards/i/IxalansBinding.java +++ b/Mage.Sets/src/mage/cards/i/IxalansBinding.java @@ -12,7 +12,6 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; -import mage.constants.Zone; import mage.filter.StaticFilters; import mage.game.ExileZone; import mage.game.Game; @@ -78,7 +77,7 @@ class IxalansBindingReplacementEffect extends ContinuousRuleModifyingEffectImpl } Card card = spellAbility.getCharacteristics(game); if (sourcePermanent != null && card != null) { - UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); if (exileZone != null) { ExileZone exile = game.getExile().getExileZone(exileZone); if (exile == null) { diff --git a/Mage.Sets/src/mage/cards/j/JacobHaukenInspector.java b/Mage.Sets/src/mage/cards/j/JacobHaukenInspector.java index 38379f9ed13..c71aedd5f2c 100644 --- a/Mage.Sets/src/mage/cards/j/JacobHaukenInspector.java +++ b/Mage.Sets/src/mage/cards/j/JacobHaukenInspector.java @@ -84,7 +84,7 @@ class JacobHaukenInspectorExileEffect extends OneShotEffect { controller.chooseTarget(outcome, controller.getHand(), target, source, game); Card card = game.getCard(target.getFirstTarget()); if (card != null) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); MageObject sourceObject = source.getSourceObject(game); String exileName = sourceObject == null ? null : sourceObject.getIdName(); card.setFaceDown(true, game); diff --git a/Mage.Sets/src/mage/cards/k/KarnLiberated.java b/Mage.Sets/src/mage/cards/k/KarnLiberated.java index 8d77814e4c7..c38cd26e79b 100644 --- a/Mage.Sets/src/mage/cards/k/KarnLiberated.java +++ b/Mage.Sets/src/mage/cards/k/KarnLiberated.java @@ -81,7 +81,7 @@ class KarnLiberatedEffect extends OneShotEffect { } List keepExiled = new ArrayList<>(); for (ExileZone zone : game.getExile().getExileZones()) { - exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); if (zone.getId().equals(exileId)) { for (Card card : zone.getCards(game)) { if (!card.hasSubtype(SubType.AURA, game) @@ -243,7 +243,7 @@ class KarnPlayerExileEffect extends OneShotEffect { TargetCardInHand target = new TargetCardInHand(); if (target.canChoose(player.getId(), source, game) && target.chooseTarget(Outcome.Exile, player.getId(), source, game)) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); return player.moveCardsToExile(new CardsImpl(target.getTargets()).getCards(game), source, game, true, exileId, sourceObject.getIdName()); } return false; diff --git a/Mage.Sets/src/mage/cards/k/KayaSpiritsJustice.java b/Mage.Sets/src/mage/cards/k/KayaSpiritsJustice.java index f2d8dc1aa49..37b4fb74752 100644 --- a/Mage.Sets/src/mage/cards/k/KayaSpiritsJustice.java +++ b/Mage.Sets/src/mage/cards/k/KayaSpiritsJustice.java @@ -219,7 +219,7 @@ class KayaSpiritsJusticeExileEffect extends OneShotEffect { controller.choose(outcome, target, source, game); Card card = game.getCard(target.getFirstTarget()); if (card != null) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); MageObject sourceObject = source.getSourceObject(game); String exileName = sourceObject == null ? null : sourceObject.getIdName(); return controller.moveCardsToExile(card, source, game, true, exileId, exileName); diff --git a/Mage.Sets/src/mage/cards/k/KnowledgePool.java b/Mage.Sets/src/mage/cards/k/KnowledgePool.java index 356eeb493c7..e553c7110c3 100644 --- a/Mage.Sets/src/mage/cards/k/KnowledgePool.java +++ b/Mage.Sets/src/mage/cards/k/KnowledgePool.java @@ -86,7 +86,7 @@ class KnowledgePoolExileThreeCardsEffect extends OneShotEffect { source, game, true, - CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), + CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()), sourceObject.getIdName() + " (" + sourceObject.getZoneChangeCounter(game) + ')' ); } diff --git a/Mage.Sets/src/mage/cards/k/KroxaTitanOfDeathsHunger.java b/Mage.Sets/src/mage/cards/k/KroxaTitanOfDeathsHunger.java index 3cc9434f5fa..44d3d508232 100644 --- a/Mage.Sets/src/mage/cards/k/KroxaTitanOfDeathsHunger.java +++ b/Mage.Sets/src/mage/cards/k/KroxaTitanOfDeathsHunger.java @@ -82,7 +82,7 @@ class KroxaTitanOfDeathsHungerEntersEffect extends OneShotEffect { if (permanent == null) { return false; } - if (EscapeAbility.wasCastedWithEscape(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter())) { + if (EscapeAbility.wasCastedWithEscape(game, source.getSourceId(), source.getStackMomentSourceZCC())) { return false; } return permanent.sacrifice(source, game); diff --git a/Mage.Sets/src/mage/cards/l/LazavWearerOfFaces.java b/Mage.Sets/src/mage/cards/l/LazavWearerOfFaces.java index b3152bf3bee..33bd4cd10e6 100644 --- a/Mage.Sets/src/mage/cards/l/LazavWearerOfFaces.java +++ b/Mage.Sets/src/mage/cards/l/LazavWearerOfFaces.java @@ -94,7 +94,7 @@ class LazavWearerOfFacesEffect extends OneShotEffect { return false; } - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); ExileZone exile = game.getExile().getExileZone(exileId); if (exile == null) { return false; diff --git a/Mage.Sets/src/mage/cards/l/LidlessGaze.java b/Mage.Sets/src/mage/cards/l/LidlessGaze.java index 2f12678b403..2ecb73f2623 100644 --- a/Mage.Sets/src/mage/cards/l/LidlessGaze.java +++ b/Mage.Sets/src/mage/cards/l/LidlessGaze.java @@ -65,7 +65,7 @@ class LidlessGazeEffect extends OneShotEffect { return false; } - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); MageObject sourceObject = source.getSourceObject(game); String exileName = sourceObject == null ? null : sourceObject.getIdName(); diff --git a/Mage.Sets/src/mage/cards/l/LifestreamsBlessing.java b/Mage.Sets/src/mage/cards/l/LifestreamsBlessing.java index 450b5f036bf..08e83d92d03 100644 --- a/Mage.Sets/src/mage/cards/l/LifestreamsBlessing.java +++ b/Mage.Sets/src/mage/cards/l/LifestreamsBlessing.java @@ -135,7 +135,7 @@ class LifestreamsBlessingWatcher extends Watcher { .getWatcher(LifestreamsBlessingWatcher.class) .map .getOrDefault(new MageObjectReference( - source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game + source.getSourceId(), source.getStackMomentSourceZCC(), game ), 0); } } diff --git a/Mage.Sets/src/mage/cards/l/LostInThought.java b/Mage.Sets/src/mage/cards/l/LostInThought.java index 703d907f8d2..42e130ef789 100644 --- a/Mage.Sets/src/mage/cards/l/LostInThought.java +++ b/Mage.Sets/src/mage/cards/l/LostInThought.java @@ -173,7 +173,7 @@ class LostInThoughtIgnoreEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - String key = source.getSourceId().toString() + source.getSourceObjectZoneChangeCounter() + LostInThought.keyString + game.getTurnNum() + ((ActivatedAbilityImpl) source).getActivatorId(); + String key = source.getSourceId().toString() + source.getStackMomentSourceZCC() + LostInThought.keyString + game.getTurnNum() + ((ActivatedAbilityImpl) source).getActivatorId(); game.getState().setValue(key, true); return true; } diff --git a/Mage.Sets/src/mage/cards/l/LumberingBattlement.java b/Mage.Sets/src/mage/cards/l/LumberingBattlement.java index 05320c9c291..4c27966baef 100644 --- a/Mage.Sets/src/mage/cards/l/LumberingBattlement.java +++ b/Mage.Sets/src/mage/cards/l/LumberingBattlement.java @@ -130,7 +130,7 @@ enum LumberingBattlementValue implements DynamicValue { } ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId( game, sourceAbility.getSourceId(), - sourceAbility.getSourceObjectZoneChangeCounter() + sourceAbility.getStackMomentSourceZCC() )); if (exileZone == null) { exileZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, sourceAbility)); diff --git a/Mage.Sets/src/mage/cards/m/MeriekeRiBerit.java b/Mage.Sets/src/mage/cards/m/MeriekeRiBerit.java index 346391f88f9..4c963312879 100644 --- a/Mage.Sets/src/mage/cards/m/MeriekeRiBerit.java +++ b/Mage.Sets/src/mage/cards/m/MeriekeRiBerit.java @@ -104,7 +104,7 @@ class MeriekeRiBeritDelayedTriggeredAbility extends DelayedTriggeredAbility { @Override public boolean isInactive(Game game) { return getSourceObjectIfItStillExists(game) == null - && game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD, getSourceObjectZoneChangeCounter()) == null; + && game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD, getStackMomentSourceZCC()) == null; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MesmericFiend.java b/Mage.Sets/src/mage/cards/m/MesmericFiend.java index d9c6b7ce5c8..127d16d0920 100644 --- a/Mage.Sets/src/mage/cards/m/MesmericFiend.java +++ b/Mage.Sets/src/mage/cards/m/MesmericFiend.java @@ -85,8 +85,8 @@ class MesmericFiendExileEffect extends OneShotEffect { if (controller.choose(Outcome.Exile, opponent.getHand(), target, source, game)) { Card card = opponent.getHand().get(target.getFirstTarget(), game); if (card != null) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); - game.getState().setValue(source.getSourceId().toString() + source.getSourceObjectZoneChangeCounter(), exileId); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); + game.getState().setValue(source.getSourceId().toString() + source.getStackMomentSourceZCC(), exileId); controller.moveCardsToExile(card, source, game, true, exileId, sourcePermanent.getName()); } } @@ -118,7 +118,7 @@ class MesmericFiendLeaveEffect extends OneShotEffect { MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { - int zoneChangeMinusOne = source.getSourceObjectZoneChangeCounter() - 1; + int zoneChangeMinusOne = source.getStackMomentSourceZCC() - 1; UUID exileId = (UUID) game.getState().getValue(source.getSourceId().toString() + zoneChangeMinusOne); if (exileId != null) { Cards cards = game.getExile().getExileZone(exileId); diff --git a/Mage.Sets/src/mage/cards/m/MirrorOfLifeTrapping.java b/Mage.Sets/src/mage/cards/m/MirrorOfLifeTrapping.java index d4e15becb54..7a94684c154 100644 --- a/Mage.Sets/src/mage/cards/m/MirrorOfLifeTrapping.java +++ b/Mage.Sets/src/mage/cards/m/MirrorOfLifeTrapping.java @@ -88,7 +88,7 @@ class MirrorOfLifeTrappingEffect extends OneShotEffect { return false; } - UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); ExileZone exileZone = game.getExile().getExileZone(exileZoneId); Cards toBattlefield = null; diff --git a/Mage.Sets/src/mage/cards/m/MoonringMirror.java b/Mage.Sets/src/mage/cards/m/MoonringMirror.java index 64e79ec3c56..1bdcdb845f6 100644 --- a/Mage.Sets/src/mage/cards/m/MoonringMirror.java +++ b/Mage.Sets/src/mage/cards/m/MoonringMirror.java @@ -64,7 +64,7 @@ class MoonringMirrorExileEffect extends OneShotEffect { Card card = controller.getLibrary().getFromTop(game); MageObject sourceObject = source.getSourceObject(game); if (card != null && sourceObject != null) { - UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); card.setFaceDown(true, game); controller.moveCardsToExile(card, source, game, false, exileZoneId, sourceObject.getIdName()); card.setFaceDown(true, game); @@ -110,7 +110,7 @@ class MoonringMirrorEffect extends OneShotEffect { return false; } - UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); ExileZone exileZone = game.getExile().getExileZone(exileZoneId); Cards cardsToHand = null; diff --git a/Mage.Sets/src/mage/cards/m/MournersShield.java b/Mage.Sets/src/mage/cards/m/MournersShield.java index 3c190addd62..68bdd029189 100644 --- a/Mage.Sets/src/mage/cards/m/MournersShield.java +++ b/Mage.Sets/src/mage/cards/m/MournersShield.java @@ -83,7 +83,7 @@ class MournersShieldImprintEffect extends OneShotEffect { if (controller != null) { Card card = game.getCard(this.getTargetPointer().getFirst(game, source)); if (card != null) { - controller.moveCardsToExile(card, source, game, true, CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), source.getSourceObject(game).getIdName()); + controller.moveCardsToExile(card, source, game, true, CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()), source.getSourceObject(game).getIdName()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { sourcePermanent.imprint(this.getTargetPointer().getFirst(game, source), game); diff --git a/Mage.Sets/src/mage/cards/n/NalathniDragon.java b/Mage.Sets/src/mage/cards/n/NalathniDragon.java index 1ef194771d7..d82de639621 100644 --- a/Mage.Sets/src/mage/cards/n/NalathniDragon.java +++ b/Mage.Sets/src/mage/cards/n/NalathniDragon.java @@ -20,7 +20,6 @@ import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Duration; import mage.constants.Outcome; -import mage.constants.Zone; import mage.game.Game; /** @@ -78,7 +77,7 @@ class NalathniDragonEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getStackMomentSourceZCC()); activationInfo.addActivation(game); if (activationInfo.getActivationCounter() >= 4) { DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeSourceEffect()); diff --git a/Mage.Sets/src/mage/cards/o/OrvarTheAllForm.java b/Mage.Sets/src/mage/cards/o/OrvarTheAllForm.java index 160f051cb85..557f25730b0 100644 --- a/Mage.Sets/src/mage/cards/o/OrvarTheAllForm.java +++ b/Mage.Sets/src/mage/cards/o/OrvarTheAllForm.java @@ -82,7 +82,7 @@ enum OrvarTheAllFormCondition implements Condition { public boolean apply(Game game, Ability source) { Spell spell = (Spell) source.getEffects().get(0).getValue("spellCast"); MageObjectReference mor; - if (source.getSourceObjectZoneChangeCounter() == 0) { + if (source.getStackMomentSourceZCC() == 0) { mor = new MageObjectReference(source.getSourceId(), game); } else { mor = new MageObjectReference(source); diff --git a/Mage.Sets/src/mage/cards/o/OutOfTime.java b/Mage.Sets/src/mage/cards/o/OutOfTime.java index 0bdb44d4440..78a6ccb5d7d 100644 --- a/Mage.Sets/src/mage/cards/o/OutOfTime.java +++ b/Mage.Sets/src/mage/cards/o/OutOfTime.java @@ -185,7 +185,7 @@ class OutOfTimeReplacementEffect extends ContinuousRuleModifyingEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { Set creatureIds = (Set) game.getState().getValue("phasedOutCreatures" + source.getId().toString()); - return source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()) // blinked + return source.getStackMomentSourceZCC() == game.getState().getZoneChangeCounter(source.getSourceId()) // blinked && creatureIds != null && creatureIds.contains(event.getTargetId()); } diff --git a/Mage.Sets/src/mage/cards/p/PalaceJailer.java b/Mage.Sets/src/mage/cards/p/PalaceJailer.java index 541d407572a..f79717e0b94 100644 --- a/Mage.Sets/src/mage/cards/p/PalaceJailer.java +++ b/Mage.Sets/src/mage/cards/p/PalaceJailer.java @@ -20,13 +20,11 @@ import mage.constants.SubType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Zone; -import mage.filter.StaticFilters; import mage.game.ExileZone; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; import mage.target.TargetPermanent; -import mage.target.common.TargetCreaturePermanent; import mage.util.CardUtil; import static mage.filter.StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE; @@ -85,7 +83,7 @@ class PalaceJailerExileEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { MageObject sourceObject = source.getSourceObject(game); if (sourceObject != null) { - return new ExileTargetEffect(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), sourceObject.getIdName()).apply(game, source); + return new ExileTargetEffect(CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()), sourceObject.getIdName()).apply(game, source); } return false; } @@ -140,7 +138,7 @@ class PalaceJailerReturnExiledPermanentsEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (sourceObject != null && controller != null) { - UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); if (exileZone != null) { ExileZone exile = game.getExile().getExileZone(exileZone); if (exile != null) { diff --git a/Mage.Sets/src/mage/cards/p/PhlageTitanOfFiresFury.java b/Mage.Sets/src/mage/cards/p/PhlageTitanOfFiresFury.java index 8da5502b868..aecefff7e03 100644 --- a/Mage.Sets/src/mage/cards/p/PhlageTitanOfFiresFury.java +++ b/Mage.Sets/src/mage/cards/p/PhlageTitanOfFiresFury.java @@ -79,7 +79,7 @@ class PhlageTitanOfFiresFuryEffect extends OneShotEffect { if (permanent == null) { return false; } - if (EscapeAbility.wasCastedWithEscape(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter())) { + if (EscapeAbility.wasCastedWithEscape(game, source.getSourceId(), source.getStackMomentSourceZCC())) { return false; } return permanent.sacrifice(source, game); diff --git a/Mage.Sets/src/mage/cards/p/PlagueReaver.java b/Mage.Sets/src/mage/cards/p/PlagueReaver.java index 8e9eed7c5fd..27bd07c4b44 100644 --- a/Mage.Sets/src/mage/cards/p/PlagueReaver.java +++ b/Mage.Sets/src/mage/cards/p/PlagueReaver.java @@ -128,7 +128,7 @@ class PlagueReaverDelayedTriggeredAbility extends DelayedTriggeredAbility { PlagueReaverDelayedTriggeredAbility(UUID playerId, Ability source) { super(new PlagueReaverReturnEffect(playerId).setTargetPointer( - new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter() + 1) + new FixedTarget(source.getSourceId(), source.getStackMomentSourceZCC() + 1) ), Duration.Custom, true, false); this.playerId = playerId; } diff --git a/Mage.Sets/src/mage/cards/p/PolukranosUnchained.java b/Mage.Sets/src/mage/cards/p/PolukranosUnchained.java index b8cf9c491f8..0fd264eeeb2 100644 --- a/Mage.Sets/src/mage/cards/p/PolukranosUnchained.java +++ b/Mage.Sets/src/mage/cards/p/PolukranosUnchained.java @@ -98,7 +98,7 @@ class PolukranosUnchainedEffect extends OneShotEffect { int counters = 12; if (!(spellAbility instanceof EscapeAbility) || !spellAbility.getSourceId().equals(source.getSourceId()) - || permanent.getZoneChangeCounter(game) != spellAbility.getSourceObjectZoneChangeCounter()) { + || permanent.getZoneChangeCounter(game) != spellAbility.getStackMomentSourceZCC()) { counters = 6; } List appliedEffects = (ArrayList) this.getValue("appliedEffects"); diff --git a/Mage.Sets/src/mage/cards/p/PuppetMaster.java b/Mage.Sets/src/mage/cards/p/PuppetMaster.java index fef7c930484..f819c91578e 100644 --- a/Mage.Sets/src/mage/cards/p/PuppetMaster.java +++ b/Mage.Sets/src/mage/cards/p/PuppetMaster.java @@ -85,7 +85,7 @@ class PuppetMasterEffect extends OneShotEffect { return false; } card = game.getCard(source.getSourceId()); - if (card == null || card.getZoneChangeCounter(game) != source.getSourceObjectZoneChangeCounter() + 1) { + if (card == null || card.getZoneChangeCounter(game) != source.getStackMomentSourceZCC() + 1) { return false; } Cost cost = new ManaCostsImpl<>("{U}{U}{U}"); diff --git a/Mage.Sets/src/mage/cards/r/RalLeylineProdigy.java b/Mage.Sets/src/mage/cards/r/RalLeylineProdigy.java index a900ac858f3..10e3fac4eb7 100644 --- a/Mage.Sets/src/mage/cards/r/RalLeylineProdigy.java +++ b/Mage.Sets/src/mage/cards/r/RalLeylineProdigy.java @@ -150,7 +150,7 @@ class RalLeylineProdigyMinusEightEffect extends OneShotEffect { return false; } Set cards = player.getLibrary().getTopCards(game, 8); - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); player.moveCardsToExile(cards, source, game, true, exileId, sourceObject.getIdName()); for (Card card : cards) { if (game.getState().getZone(card.getId()) == Zone.EXILED) { @@ -203,4 +203,4 @@ class RalLeylineProdigyCastEffect extends AsThoughEffectImpl { allowCardToPlayWithoutMana(mainId, source, affectedControllerId, MageIdentifier.WithoutPayingManaCostAlternateCast, game); return true; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/s/SalvationSwan.java b/Mage.Sets/src/mage/cards/s/SalvationSwan.java index 9b5b56c967d..212423de2ce 100644 --- a/Mage.Sets/src/mage/cards/s/SalvationSwan.java +++ b/Mage.Sets/src/mage/cards/s/SalvationSwan.java @@ -123,7 +123,7 @@ class SalvationSwanTargetEffect extends OneShotEffect { game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source); // move exiled cards to shared zone for better UX - String exileKey = SalvationSwan.VALUE_PREFIX + "_" + source.getSourceId() + "_" + source.getSourceObjectZoneChangeCounter(); + String exileKey = SalvationSwan.VALUE_PREFIX + "_" + source.getSourceId() + "_" + source.getStackMomentSourceZCC(); ExileZone sharedExileZone = game.getExile().createZone( CardUtil.getExileZoneId(exileKey, game), sourceObject.getIdName() diff --git a/Mage.Sets/src/mage/cards/s/ServantOfTheScale.java b/Mage.Sets/src/mage/cards/s/ServantOfTheScale.java index 8ecde4bfcbb..0bb686c5766 100644 --- a/Mage.Sets/src/mage/cards/s/ServantOfTheScale.java +++ b/Mage.Sets/src/mage/cards/s/ServantOfTheScale.java @@ -76,8 +76,8 @@ class ServantOfTheScaleEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); if (sourcePermanent != null && controller != null - && (sourcePermanent.getZoneChangeCounter(game) == source.getSourceObjectZoneChangeCounter() // Token - || sourcePermanent.getZoneChangeCounter(game) + 1 == source.getSourceObjectZoneChangeCounter())) { // PermanentCard + && (sourcePermanent.getZoneChangeCounter(game) == source.getStackMomentSourceZCC() // Token + || sourcePermanent.getZoneChangeCounter(game) + 1 == source.getStackMomentSourceZCC())) { // PermanentCard int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); if (amount > 0) { Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(amount)); diff --git a/Mage.Sets/src/mage/cards/s/Shyft.java b/Mage.Sets/src/mage/cards/s/Shyft.java index e1fe7f8d467..97a99ed3ca6 100644 --- a/Mage.Sets/src/mage/cards/s/Shyft.java +++ b/Mage.Sets/src/mage/cards/s/Shyft.java @@ -63,7 +63,7 @@ class ShyftEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Effect effect = new BecomesColorOrColorsTargetEffect(Duration.Custom); - effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter())); + effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getStackMomentSourceZCC())); return effect.apply(game, source); } } diff --git a/Mage.Sets/src/mage/cards/s/SinisterConcierge.java b/Mage.Sets/src/mage/cards/s/SinisterConcierge.java index f7ae1aced8b..09ad27db1ce 100644 --- a/Mage.Sets/src/mage/cards/s/SinisterConcierge.java +++ b/Mage.Sets/src/mage/cards/s/SinisterConcierge.java @@ -69,7 +69,7 @@ class SinisterConciergeEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); Card card = game.getCard(source.getSourceId()); if (controller == null || card == null - || card.getZoneChangeCounter(game) != source.getSourceObjectZoneChangeCounter() + || card.getZoneChangeCounter(game) != source.getStackMomentSourceZCC() || !Zone.GRAVEYARD.match(game.getState().getZone(card.getId()))) { return false; } diff --git a/Mage.Sets/src/mage/cards/s/SkyclaveShade.java b/Mage.Sets/src/mage/cards/s/SkyclaveShade.java index 3f984c77990..08e7007de18 100644 --- a/Mage.Sets/src/mage/cards/s/SkyclaveShade.java +++ b/Mage.Sets/src/mage/cards/s/SkyclaveShade.java @@ -102,6 +102,6 @@ class SkyclaveShadeEffect extends AsThoughEffectImpl { Card card = game.getCard(source.getSourceId()); return card != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD - && source.getSourceObjectZoneChangeCounter() == card.getZoneChangeCounter(game); + && source.getStackMomentSourceZCC() == card.getZoneChangeCounter(game); } } diff --git a/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java b/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java index 18681cad8e2..50590ed0cc3 100644 --- a/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java +++ b/Mage.Sets/src/mage/cards/s/SkyshipWeatherlight.java @@ -86,7 +86,7 @@ class SkyshipWeatherlightEffect extends SearchEffect { MageObject sourceObject = source.getSourceObject(game); if (sourceObject != null && controller != null) { if (controller.searchLibrary(target, source, game)) { - UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); if (!target.getTargets().isEmpty()) { for (UUID cardID : target.getTargets()) { Card card = controller.getLibrary().getCard(cardID, game); @@ -125,7 +125,7 @@ class SkyshipWeatherlightEffect2 extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (sourceObject != null && controller != null) { - ExileZone exZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter())); + ExileZone exZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC())); if (exZone != null) { controller.moveCards(exZone.getRandom(game), Zone.HAND, source, game); } diff --git a/Mage.Sets/src/mage/cards/s/SkywayRobber.java b/Mage.Sets/src/mage/cards/s/SkywayRobber.java index 25e90be8490..7d526627f66 100644 --- a/Mage.Sets/src/mage/cards/s/SkywayRobber.java +++ b/Mage.Sets/src/mage/cards/s/SkywayRobber.java @@ -85,7 +85,7 @@ class SkywayRobberCastForFreeEffect extends OneShotEffect { if (controller == null) { return false; } - String exileZoneName = CardUtil.getObjectZoneString(CardUtil.SOURCE_EXILE_ZONE_TEXT, source.getSourceId(), game, source.getSourceObjectZoneChangeCounter()-1, false); + String exileZoneName = CardUtil.getObjectZoneString(CardUtil.SOURCE_EXILE_ZONE_TEXT, source.getSourceId(), game, source.getStackMomentSourceZCC()-1, false); UUID exileId = CardUtil.getExileZoneId(exileZoneName, game); ExileZone exileZone = game.getExile().getExileZone(exileId); if (exileZone == null) { diff --git a/Mage.Sets/src/mage/cards/s/SoulgorgerOrgg.java b/Mage.Sets/src/mage/cards/s/SoulgorgerOrgg.java index dce856d8e84..d81b8ed0b72 100644 --- a/Mage.Sets/src/mage/cards/s/SoulgorgerOrgg.java +++ b/Mage.Sets/src/mage/cards/s/SoulgorgerOrgg.java @@ -74,7 +74,7 @@ class SoulgorgerOrggLoseLifeEffect extends OneShotEffect { if (player.getLife() > 1) { lifeValue = player.getLife() - 1; } - game.getState().setValue(source.getSourceId().toString() + source.getControllerId().toString() + source.getSourceObjectZoneChangeCounter() + "_lifeValue", lifeValue); + game.getState().setValue(source.getSourceId().toString() + source.getControllerId().toString() + source.getStackMomentSourceZCC() + "_lifeValue", lifeValue); if (lifeValue > 0) { player.loseLife(lifeValue, game, source, false); } @@ -103,7 +103,7 @@ class SoulgorgerOrggGainLifeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - Object obj = game.getState().getValue(source.getSourceId().toString() + source.getControllerId().toString() + (source.getSourceObjectZoneChangeCounter() - 1) + "_lifeValue"); + Object obj = game.getState().getValue(source.getSourceId().toString() + source.getControllerId().toString() + (source.getStackMomentSourceZCC() - 1) + "_lifeValue"); if (!(obj instanceof Integer)) { return false; } diff --git a/Mage.Sets/src/mage/cards/s/SpellQueller.java b/Mage.Sets/src/mage/cards/s/SpellQueller.java index c2f829bd6bd..aa3ee3feb0a 100644 --- a/Mage.Sets/src/mage/cards/s/SpellQueller.java +++ b/Mage.Sets/src/mage/cards/s/SpellQueller.java @@ -96,7 +96,7 @@ class SpellQuellerEntersEffect extends OneShotEffect { if (controller != null && sourceObject != null) { Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source)); if (spell != null) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); return controller.moveCardsToExile(spell, source, game, true, exileId, sourceObject.getIdName()); } return true; diff --git a/Mage.Sets/src/mage/cards/s/SpellweaverHelix.java b/Mage.Sets/src/mage/cards/s/SpellweaverHelix.java index 89bbba6f492..d7c85e42f62 100644 --- a/Mage.Sets/src/mage/cards/s/SpellweaverHelix.java +++ b/Mage.Sets/src/mage/cards/s/SpellweaverHelix.java @@ -83,7 +83,7 @@ class SpellweaverHelixImprintEffect extends OneShotEffect { for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { Card card = game.getCard(targetId); if (card != null) { - controller.moveCardsToExile(card, source, game, true, CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()), source.getSourceObject(game).getIdName()); + controller.moveCardsToExile(card, source, game, true, CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()), source.getSourceObject(game).getIdName()); if (sourcePermanent != null) { sourcePermanent.imprint(targetId, game); } diff --git a/Mage.Sets/src/mage/cards/s/SynodSanctum.java b/Mage.Sets/src/mage/cards/s/SynodSanctum.java index 3f300841cdf..2f4f54cf0ac 100644 --- a/Mage.Sets/src/mage/cards/s/SynodSanctum.java +++ b/Mage.Sets/src/mage/cards/s/SynodSanctum.java @@ -83,7 +83,7 @@ class SynodSanctumEffect extends OneShotEffect { if (getTargetPointer().getFirst(game, source) != null) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); if (exileZone != null) { controller.moveCardToExileWithInfo(permanent, exileZone, sourceObject.getIdName(), source, game, Zone.BATTLEFIELD, true); } @@ -113,7 +113,7 @@ class SynodSanctumEffect2 extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); ExileZone exileZone = game.getExile().getExileZone(exileId); if (exileZone == null) { return true; diff --git a/Mage.Sets/src/mage/cards/t/TalionTheKindlyLord.java b/Mage.Sets/src/mage/cards/t/TalionTheKindlyLord.java index 19ccefbf0f6..bb9e7e6c6d6 100644 --- a/Mage.Sets/src/mage/cards/t/TalionTheKindlyLord.java +++ b/Mage.Sets/src/mage/cards/t/TalionTheKindlyLord.java @@ -111,7 +111,7 @@ class TalionTheKindlyLordEffect extends OneShotEffect { } int numberChoice = controller.getAmount(1, 10, "Choose a number.", source, game); game.getState().setValue("chosenNumber_" + source.getSourceId() - + '_' + source.getSourceObjectZoneChangeCounter(), numberChoice); + + '_' + source.getStackMomentSourceZCC(), numberChoice); Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (permanent != null) { permanent.addInfo("chosen players", "Chosen Number: " + numberChoice + "", game); diff --git a/Mage.Sets/src/mage/cards/t/TheAesirEscapeValhalla.java b/Mage.Sets/src/mage/cards/t/TheAesirEscapeValhalla.java index 59e83c71b2d..cb659de5718 100644 --- a/Mage.Sets/src/mage/cards/t/TheAesirEscapeValhalla.java +++ b/Mage.Sets/src/mage/cards/t/TheAesirEscapeValhalla.java @@ -116,7 +116,7 @@ class TheAesirEscapeValhallaTwoEffect extends OneShotEffect { if (controller == null || sourceObject == null) { return false; } - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); ExileZone exileZone = game.getExile().getExileZone(exileId); if (exileZone == null || exileZone.isEmpty()) { return false; @@ -154,7 +154,7 @@ class TheAesirEscapeValhallaThreeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); ExileZone exileZone = game.getExile().getExileZone(exileId); Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/t/TheCreationOfAvacyn.java b/Mage.Sets/src/mage/cards/t/TheCreationOfAvacyn.java index 17b28d39754..1e89f2a9483 100644 --- a/Mage.Sets/src/mage/cards/t/TheCreationOfAvacyn.java +++ b/Mage.Sets/src/mage/cards/t/TheCreationOfAvacyn.java @@ -119,7 +119,7 @@ class TheCreationOfAvacynTwoEffect extends OneShotEffect { // ability (likely because the triggered ability was copied or the ability triggered a second time), the second // chapter ability will turn all of the exiled cards face up. If at least one of them is a creature card, you'll // lose life equal to the combined mana value of all the exiled cards. - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); ExileZone exileZone = game.getExile().getExileZone(exileId); if (exileZone == null || exileZone.isEmpty()) { return false; @@ -163,7 +163,7 @@ class TheCreationOfAvacynThreeEffect extends OneShotEffect { // when the third chapter ability resolves, if at least one of the exiled cards is a creature card, you may choose // to put all or none of the exiled cards that are permanent cards onto the battlefield. Regardless of what you // choose, any remaining exiled cards will be put into their owners' hands. - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); ExileZone exileZone = game.getExile().getExileZone(exileId); Player controller = game.getPlayer(source.getControllerId()); if (controller == null || exileZone == null || exileZone.isEmpty()) { diff --git a/Mage.Sets/src/mage/cards/t/TheLocustGod.java b/Mage.Sets/src/mage/cards/t/TheLocustGod.java index f1d0f8526c1..62afa8bb57a 100644 --- a/Mage.Sets/src/mage/cards/t/TheLocustGod.java +++ b/Mage.Sets/src/mage/cards/t/TheLocustGod.java @@ -22,7 +22,6 @@ import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Outcome; import mage.constants.SuperType; -import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.token.TheLocustGodInsectToken; import mage.target.targetpointer.FixedTarget; @@ -83,7 +82,7 @@ class TheLocustGodEffect extends OneShotEffect { // Create delayed triggered ability Effect effect = new ReturnToHandTargetEffect(); effect.setText("return {this} to its owner's hand"); - effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter())); + effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getStackMomentSourceZCC())); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); game.addDelayedTriggeredAbility(delayedAbility, source); return true; diff --git a/Mage.Sets/src/mage/cards/t/TheScarabGod.java b/Mage.Sets/src/mage/cards/t/TheScarabGod.java index 500c819a2ec..17deb6d479a 100644 --- a/Mage.Sets/src/mage/cards/t/TheScarabGod.java +++ b/Mage.Sets/src/mage/cards/t/TheScarabGod.java @@ -127,7 +127,7 @@ class TheScarabGodEffectDieEffect extends OneShotEffect { // Create delayed triggered ability Effect effect = new ReturnToHandTargetEffect(); effect.setText("return {this} to its owner's hand"); - effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter())); + effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getStackMomentSourceZCC())); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); game.addDelayedTriggeredAbility(delayedAbility, source); return true; diff --git a/Mage.Sets/src/mage/cards/t/TheScorpionGod.java b/Mage.Sets/src/mage/cards/t/TheScorpionGod.java index 67ecd405fac..32a52560d5a 100644 --- a/Mage.Sets/src/mage/cards/t/TheScorpionGod.java +++ b/Mage.Sets/src/mage/cards/t/TheScorpionGod.java @@ -24,13 +24,11 @@ import mage.constants.Outcome; import mage.constants.SuperType; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.StaticFilters; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; -import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.FixedTarget; import static mage.filter.StaticFilters.FILTER_ANOTHER_TARGET_CREATURE; @@ -135,7 +133,7 @@ class TheScorpionGodEffect extends OneShotEffect { // Create delayed triggered ability Effect effect = new ReturnToHandTargetEffect(); effect.setText("return {this} to its owner's hand"); - effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter())); + effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getStackMomentSourceZCC())); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); game.addDelayedTriggeredAbility(delayedAbility, source); return true; diff --git a/Mage.Sets/src/mage/cards/t/TheTombOfAclazotz.java b/Mage.Sets/src/mage/cards/t/TheTombOfAclazotz.java index 13faadff179..18e338ca97f 100644 --- a/Mage.Sets/src/mage/cards/t/TheTombOfAclazotz.java +++ b/Mage.Sets/src/mage/cards/t/TheTombOfAclazotz.java @@ -152,14 +152,14 @@ class TheTombOfAclazotzWatcher extends Watcher { return false; } MageObjectReference mor = new MageObjectReference( - source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game + source.getSourceId(), source.getStackMomentSourceZCC(), game ); return morMap.computeIfAbsent(mor, m -> new HashMap<>()).getOrDefault(playerId, 0) > 0; } void addPlayable(Ability source, Game game) { MageObjectReference mor = new MageObjectReference( - source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game + source.getSourceId(), source.getStackMomentSourceZCC(), game ); morMap.computeIfAbsent(mor, m -> new HashMap<>()) .compute(source.getControllerId(), CardUtil::setOrIncrementValue); diff --git a/Mage.Sets/src/mage/cards/t/TheToymakersTrap.java b/Mage.Sets/src/mage/cards/t/TheToymakersTrap.java index 3207b2c743c..0ddd5af43eb 100644 --- a/Mage.Sets/src/mage/cards/t/TheToymakersTrap.java +++ b/Mage.Sets/src/mage/cards/t/TheToymakersTrap.java @@ -121,7 +121,7 @@ class TheToymakersTrapEffect extends OneShotEffect { } private static List getOrSetValue(Game game, Ability source) { - String key = "chosenNumbers_" + source.getControllerId() + '_' + source.getSourceObjectZoneChangeCounter(); + String key = "chosenNumbers_" + source.getControllerId() + '_' + source.getStackMomentSourceZCC(); List list = (List) game.getState().getValue(key); if (list != null) { return list; diff --git a/Mage.Sets/src/mage/cards/t/TidehollowSculler.java b/Mage.Sets/src/mage/cards/t/TidehollowSculler.java index 39ac31df872..b8c51248c0e 100644 --- a/Mage.Sets/src/mage/cards/t/TidehollowSculler.java +++ b/Mage.Sets/src/mage/cards/t/TidehollowSculler.java @@ -92,7 +92,7 @@ class TidehollowScullerExileEffect extends OneShotEffect { true, CardUtil.getExileZoneId(game, source.getSourceId(), - source.getSourceObjectZoneChangeCounter()), + source.getStackMomentSourceZCC()), "Tidehollow Sculler"); } } @@ -124,8 +124,8 @@ class TidehollowScullerLeaveEffect extends OneShotEffect { MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { int zoneChangeCounter = (sourceObject instanceof PermanentToken) - ? source.getSourceObjectZoneChangeCounter() - : source.getSourceObjectZoneChangeCounter() - 1; + ? source.getStackMomentSourceZCC() + : source.getStackMomentSourceZCC() - 1; ExileZone exZone = game.getExile().getExileZone( CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter)); if (exZone != null) { diff --git a/Mage.Sets/src/mage/cards/t/TizerusCharger.java b/Mage.Sets/src/mage/cards/t/TizerusCharger.java index 729d2e28491..4d9c78e58c3 100644 --- a/Mage.Sets/src/mage/cards/t/TizerusCharger.java +++ b/Mage.Sets/src/mage/cards/t/TizerusCharger.java @@ -82,7 +82,7 @@ class TizerusChargerEffect extends OneShotEffect { SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); if (!(spellAbility instanceof EscapeAbility) || !spellAbility.getSourceId().equals(source.getSourceId()) - || permanent.getZoneChangeCounter(game) != spellAbility.getSourceObjectZoneChangeCounter()) { + || permanent.getZoneChangeCounter(game) != spellAbility.getStackMomentSourceZCC()) { return false; } List appliedEffects = (ArrayList) this.getValue("appliedEffects"); diff --git a/Mage.Sets/src/mage/cards/t/ToluzCleverConductor.java b/Mage.Sets/src/mage/cards/t/ToluzCleverConductor.java index c011bfd9f15..7a44c7687b6 100644 --- a/Mage.Sets/src/mage/cards/t/ToluzCleverConductor.java +++ b/Mage.Sets/src/mage/cards/t/ToluzCleverConductor.java @@ -114,7 +114,7 @@ class ToluzCleverConductorEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter() - 1)); + ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC() - 1)); return player != null && exileZone != null && !exileZone.isEmpty() diff --git a/Mage.Sets/src/mage/cards/t/TriumphOfSaintKatherine.java b/Mage.Sets/src/mage/cards/t/TriumphOfSaintKatherine.java index ea217662dfb..1d66ae330e1 100644 --- a/Mage.Sets/src/mage/cards/t/TriumphOfSaintKatherine.java +++ b/Mage.Sets/src/mage/cards/t/TriumphOfSaintKatherine.java @@ -74,7 +74,7 @@ class TriumphOfSaintKatherineEffect extends OneShotEffect { return false; } Cards cards = new CardsImpl(); - if (card.getZoneChangeCounter(game) == source.getSourceObjectZoneChangeCounter()) { + if (card.getZoneChangeCounter(game) == source.getStackMomentSourceZCC()) { cards.add(card); } cards.addAllCards(player.getLibrary().getTopCards(game, 6)); diff --git a/Mage.Sets/src/mage/cards/u/UginTheIneffable.java b/Mage.Sets/src/mage/cards/u/UginTheIneffable.java index 848ee849bca..d18b19a832c 100644 --- a/Mage.Sets/src/mage/cards/u/UginTheIneffable.java +++ b/Mage.Sets/src/mage/cards/u/UginTheIneffable.java @@ -110,7 +110,7 @@ class UginTheIneffableEffect extends OneShotEffect { } // exile and look - UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); if (player.moveCardsToExile(card, source, game, false, exileZoneId, sourceObject.getIdName() + " (" + player.getName() + ")")) { card.turnFaceDown(source, game, source.getControllerId()); player.lookAtCards(player.getName() + " - " + card.getIdName() + " - " + CardUtil.sdf.format(System.currentTimeMillis()), card, game); diff --git a/Mage.Sets/src/mage/cards/u/UnderworldSentinel.java b/Mage.Sets/src/mage/cards/u/UnderworldSentinel.java index 40db7ee5970..293aabd7b23 100644 --- a/Mage.Sets/src/mage/cards/u/UnderworldSentinel.java +++ b/Mage.Sets/src/mage/cards/u/UnderworldSentinel.java @@ -76,7 +76,7 @@ class UnderworldSentinelEffect extends OneShotEffect { return false; } ExileZone exileZone = game.getExile().getExileZone( - CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()) + CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()) ); return exileZone != null && controller.moveCards(exileZone, Zone.BATTLEFIELD, source, game); } diff --git a/Mage.Sets/src/mage/cards/u/UroTitanOfNaturesWrath.java b/Mage.Sets/src/mage/cards/u/UroTitanOfNaturesWrath.java index 4007b7a02ec..9d373da06b3 100644 --- a/Mage.Sets/src/mage/cards/u/UroTitanOfNaturesWrath.java +++ b/Mage.Sets/src/mage/cards/u/UroTitanOfNaturesWrath.java @@ -80,7 +80,7 @@ class UroTitanOfNaturesWrathEffect extends OneShotEffect { if (permanent == null) { return false; } - if (EscapeAbility.wasCastedWithEscape(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter())) { + if (EscapeAbility.wasCastedWithEscape(game, source.getSourceId(), source.getStackMomentSourceZCC())) { return false; } return permanent.sacrifice(source, game); diff --git a/Mage.Sets/src/mage/cards/v/ValakutExploration.java b/Mage.Sets/src/mage/cards/v/ValakutExploration.java index 796840a0131..0a41204bdbb 100644 --- a/Mage.Sets/src/mage/cards/v/ValakutExploration.java +++ b/Mage.Sets/src/mage/cards/v/ValakutExploration.java @@ -97,7 +97,7 @@ class ValakutExplorationExileEffect extends OneShotEffect { } controller.moveCardsToExile( card, source, game, true, CardUtil.getExileZoneId( - game, source.getSourceId(), source.getSourceObjectZoneChangeCounter() + game, source.getSourceId(), source.getStackMomentSourceZCC() ), sourcePermanent.getIdName() ); ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Duration.EndOfGame); @@ -130,7 +130,7 @@ class ValakutExplorationDamageEffect extends OneShotEffect { return false; } ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId( - game, source.getSourceId(), source.getSourceObjectZoneChangeCounter() + game, source.getSourceId(), source.getStackMomentSourceZCC() )); if (exileZone == null) { return false; diff --git a/Mage.Sets/src/mage/cards/v/VolrathsCurse.java b/Mage.Sets/src/mage/cards/v/VolrathsCurse.java index ad01f63f065..e02f19c48e4 100644 --- a/Mage.Sets/src/mage/cards/v/VolrathsCurse.java +++ b/Mage.Sets/src/mage/cards/v/VolrathsCurse.java @@ -176,7 +176,7 @@ class VolrathsCurseIgnoreEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - String key = source.getSourceId().toString() + source.getSourceObjectZoneChangeCounter() + VolrathsCurse.keyString + game.getTurnNum() + ((ActivatedAbilityImpl) source).getActivatorId(); + String key = source.getSourceId().toString() + source.getStackMomentSourceZCC() + VolrathsCurse.keyString + game.getTurnNum() + ((ActivatedAbilityImpl) source).getActivatorId(); game.getState().setValue(key, true); return true; } diff --git a/Mage.Sets/src/mage/cards/w/WallOfDeceit.java b/Mage.Sets/src/mage/cards/w/WallOfDeceit.java index 1b6dddd9013..0e7fac077b1 100644 --- a/Mage.Sets/src/mage/cards/w/WallOfDeceit.java +++ b/Mage.Sets/src/mage/cards/w/WallOfDeceit.java @@ -14,7 +14,6 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; -import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; @@ -70,7 +69,7 @@ class WallOfDeceitEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null - && source.getSourceObjectZoneChangeCounter() == sourcePermanent.getZoneChangeCounter(game) // in case source was blinked after ability was set to stack + && source.getStackMomentSourceZCC() == sourcePermanent.getZoneChangeCounter(game) // in case source was blinked after ability was set to stack && !sourcePermanent.isFaceDown(game)) { sourcePermanent.setFaceDown(true, game); } diff --git a/Mage.Sets/src/mage/cards/w/WhispersteelDagger.java b/Mage.Sets/src/mage/cards/w/WhispersteelDagger.java index 74c8976c803..b958fb4edae 100644 --- a/Mage.Sets/src/mage/cards/w/WhispersteelDagger.java +++ b/Mage.Sets/src/mage/cards/w/WhispersteelDagger.java @@ -176,7 +176,7 @@ class WhispersteelDaggerWatcher extends Watcher { return false; } MageObjectReference mor = new MageObjectReference( - source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game + source.getSourceId(), source.getStackMomentSourceZCC(), game ); if (!morMap.containsKey(mor)) { return false; @@ -188,7 +188,7 @@ class WhispersteelDaggerWatcher extends Watcher { void addPlayable(Ability source, UUID ownerId, Game game) { MageObjectReference mor = new MageObjectReference( - source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game + source.getSourceId(), source.getStackMomentSourceZCC(), game ); morMap.computeIfAbsent(mor, m -> new HashMap<>()) .computeIfAbsent(ownerId, m -> new HashMap<>()) diff --git a/Mage.Sets/src/mage/cards/w/WoebringerDemon.java b/Mage.Sets/src/mage/cards/w/WoebringerDemon.java index 26dbfd48dea..c8fc750d63b 100644 --- a/Mage.Sets/src/mage/cards/w/WoebringerDemon.java +++ b/Mage.Sets/src/mage/cards/w/WoebringerDemon.java @@ -84,7 +84,7 @@ class WoebringerDemonEffect extends OneShotEffect { } } Permanent sourceObject = game.getPermanent(source.getSourceId()); - if (sourceObject != null && sourceObject.getZoneChangeCounter(game) == source.getSourceObjectZoneChangeCounter()) { + if (sourceObject != null && sourceObject.getZoneChangeCounter(game) == source.getStackMomentSourceZCC()) { sourceObject.sacrifice(source, game); } return true; diff --git a/Mage.Sets/src/mage/cards/w/WorldgorgerDragon.java b/Mage.Sets/src/mage/cards/w/WorldgorgerDragon.java index ea9d06a53da..b64f0fdec2d 100644 --- a/Mage.Sets/src/mage/cards/w/WorldgorgerDragon.java +++ b/Mage.Sets/src/mage/cards/w/WorldgorgerDragon.java @@ -86,7 +86,7 @@ class WorldgorgerDragonEntersEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null) { - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); if (exileId != null) { Set cardsToExile = new LinkedHashSet<>(); cardsToExile.addAll(game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)); @@ -119,7 +119,7 @@ class WorldgorgerDragonLeavesEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { - int zoneChangeCounter = (sourceObject instanceof PermanentToken) ? source.getSourceObjectZoneChangeCounter() : source.getSourceObjectZoneChangeCounter() - 1; + int zoneChangeCounter = (sourceObject instanceof PermanentToken) ? source.getStackMomentSourceZCC() : source.getStackMomentSourceZCC() - 1; ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter)); if (exile != null) { return controller.moveCards(exile.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null); diff --git a/Mage.Sets/src/mage/cards/y/YannikScavengingSentinel.java b/Mage.Sets/src/mage/cards/y/YannikScavengingSentinel.java index 9c4997e3944..63400e1b2d6 100644 --- a/Mage.Sets/src/mage/cards/y/YannikScavengingSentinel.java +++ b/Mage.Sets/src/mage/cards/y/YannikScavengingSentinel.java @@ -93,7 +93,7 @@ class YannikScavengingSentinelEffect extends OneShotEffect { } int power = permanent.getPower().getValue(); new ExileTargetEffect(CardUtil.getExileZoneId( - game, source.getSourceId(), source.getSourceObjectZoneChangeCounter() + game, source.getSourceId(), source.getStackMomentSourceZCC() ), permanent.getIdName()).setTargetPointer(new FixedTarget(permanent, game)).apply(game, source); game.addDelayedTriggeredAbility(new OnLeaveReturnExiledAbility(), source); if (game.getState().getZone(permanent.getId()) != Zone.BATTLEFIELD) { diff --git a/Mage/src/main/java/mage/MageObjectReference.java b/Mage/src/main/java/mage/MageObjectReference.java index dd18a605c13..6fe3eff9337 100644 --- a/Mage/src/main/java/mage/MageObjectReference.java +++ b/Mage/src/main/java/mage/MageObjectReference.java @@ -65,7 +65,7 @@ public class MageObjectReference implements Comparable, Ser @Deprecated // cause of many bugs, see issue #10479 public MageObjectReference(Ability source, int modifier) { this.sourceId = source.getSourceId(); - this.zoneChangeCounter = source.getSourceObjectZoneChangeCounter() + modifier; + this.zoneChangeCounter = source.getStackMomentSourceZCC() + modifier; } /** @@ -162,8 +162,8 @@ public class MageObjectReference implements Comparable, Ser if (source == null || !source.getSourceId().equals(sourceId)) { return false; } - return zoneChangeCounter * source.getSourceObjectZoneChangeCounter() == 0 - || zoneChangeCounter == source.getSourceObjectZoneChangeCounter(); + return zoneChangeCounter * source.getStackMomentSourceZCC() == 0 + || zoneChangeCounter == source.getStackMomentSourceZCC(); } public Permanent getPermanent(Game game) { diff --git a/Mage/src/main/java/mage/abilities/Ability.java b/Mage/src/main/java/mage/abilities/Ability.java index a834cf8be68..c05feea8548 100644 --- a/Mage/src/main/java/mage/abilities/Ability.java +++ b/Mage/src/main/java/mage/abilities/Ability.java @@ -516,11 +516,12 @@ public interface Ability extends Controllable, Serializable { */ void initSourceObjectZoneChangeCounter(Game game, boolean force); - // TODO: it's activating time of ability, not current object's zcc, see #13737, - // in most use cases you must use game.getState().getZoneChangeCounter or input.getObject().getZoneChangeCounter(game) - // only ability related logic can use it (example: delayed triggers) - @Deprecated - int getSourceObjectZoneChangeCounter(); + /** + * Returns the internally stored Source Object ZCC value, which is set at the time this ability was put on the stack. + * For static abilities or trigger conditions, you probably want to use + * game.getState().getZoneChangeCounter or input.getObject().getZoneChangeCounter(game) instead + */ + int getStackMomentSourceZCC(); /** * Finds the source object (Permanent, StackObject, Card, etc.) as long as its zcc has not changed, otherwise null diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 479fe01ef6a..afe43785d56 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -1658,8 +1658,8 @@ public abstract class AbilityImpl implements Ability { @Override public MageObject getSourceObjectIfItStillExists(Game game) { - if (getSourceObjectZoneChangeCounter() == 0 - || getSourceObjectZoneChangeCounter() == getCurrentSourceObjectZoneChangeCounter(game)) { + if (getStackMomentSourceZCC() == 0 + || getStackMomentSourceZCC() == getCurrentSourceObjectZoneChangeCounter(game)) { // exists or lki from battlefield return game.getObject(getSourceId()); } @@ -1688,7 +1688,7 @@ public abstract class AbilityImpl implements Ability { public Permanent getSourcePermanentOrLKI(Game game) { Permanent permanent = getSourcePermanentIfItStillExists(game); if (permanent == null) { - permanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD, getSourceObjectZoneChangeCounter()); + permanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD, getStackMomentSourceZCC()); } return permanent; } @@ -1720,7 +1720,7 @@ public abstract class AbilityImpl implements Ability { } @Override - public int getSourceObjectZoneChangeCounter() { + public int getStackMomentSourceZCC() { return sourceObjectZoneChangeCounter; } diff --git a/Mage/src/main/java/mage/abilities/TriggeredAbilities.java b/Mage/src/main/java/mage/abilities/TriggeredAbilities.java index bb683bce3ea..1e745ea6294 100644 --- a/Mage/src/main/java/mage/abilities/TriggeredAbilities.java +++ b/Mage/src/main/java/mage/abilities/TriggeredAbilities.java @@ -241,7 +241,7 @@ public class TriggeredAbilities extends LinkedHashMap && game.getLKI().get(Zone.BATTLEFIELD) != null && game.getLKI().get(Zone.BATTLEFIELD).containsKey(ability.getSourceId())) { // need to check if object was face down for dies and destroy events because the ability triggers in the new zone, zone counter -1 is used - Permanent permanent = (Permanent) game.getLastKnownInformation(ability.getSourceId(), Zone.BATTLEFIELD, ability.getSourceObjectZoneChangeCounter() - 1); + Permanent permanent = (Permanent) game.getLastKnownInformation(ability.getSourceId(), Zone.BATTLEFIELD, ability.getStackMomentSourceZCC() - 1); if (permanent != null) { if (permanent.isFaceDown(game) && !isGainedAbility(ability, permanent) // the face down creature got the ability from an effect => so it should work diff --git a/Mage/src/main/java/mage/abilities/common/EscapesWithAbility.java b/Mage/src/main/java/mage/abilities/common/EscapesWithAbility.java index 095d277702a..6ac1bdcefb7 100644 --- a/Mage/src/main/java/mage/abilities/common/EscapesWithAbility.java +++ b/Mage/src/main/java/mage/abilities/common/EscapesWithAbility.java @@ -100,7 +100,7 @@ class EscapesWithEffect extends OneShotEffect { SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); if (!(spellAbility instanceof EscapeAbility) || !spellAbility.getSourceId().equals(source.getSourceId()) - || permanent.getZoneChangeCounter(game) != spellAbility.getSourceObjectZoneChangeCounter()) { + || permanent.getZoneChangeCounter(game) != spellAbility.getStackMomentSourceZCC()) { return false; } diff --git a/Mage/src/main/java/mage/abilities/common/delayed/OnLeaveReturnExiledAbility.java b/Mage/src/main/java/mage/abilities/common/delayed/OnLeaveReturnExiledAbility.java index 33afa3d86df..c1a47c44bc5 100644 --- a/Mage/src/main/java/mage/abilities/common/delayed/OnLeaveReturnExiledAbility.java +++ b/Mage/src/main/java/mage/abilities/common/delayed/OnLeaveReturnExiledAbility.java @@ -103,7 +103,7 @@ class ReturnExiledPermanentsEffect extends OneShotEffect { } private ExileZone getExileIfPossible(final Game game, final Ability source) { - UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); if (exileZone != null) { ExileZone exile = game.getExile().getExileZone(exileZone); diff --git a/Mage/src/main/java/mage/abilities/common/delayed/UntilYourNextTurnDelayedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/delayed/UntilYourNextTurnDelayedTriggeredAbility.java index 86c873bdf00..cf51f1f5b3f 100644 --- a/Mage/src/main/java/mage/abilities/common/delayed/UntilYourNextTurnDelayedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/delayed/UntilYourNextTurnDelayedTriggeredAbility.java @@ -111,8 +111,8 @@ public class UntilYourNextTurnDelayedTriggeredAbility extends DelayedTriggeredAb } @Override - public int getSourceObjectZoneChangeCounter() { - return ability.getSourceObjectZoneChangeCounter(); + public int getStackMomentSourceZCC() { + return ability.getStackMomentSourceZCC(); } @Override diff --git a/Mage/src/main/java/mage/abilities/condition/common/CastAnotherSpellThisTurnCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CastAnotherSpellThisTurnCondition.java index 10ee9bdd27f..d2368d42dba 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/CastAnotherSpellThisTurnCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/CastAnotherSpellThisTurnCondition.java @@ -30,7 +30,7 @@ public enum CastAnotherSpellThisTurnCondition implements Condition { return spells != null && spells .stream() .filter(Objects::nonNull) - .anyMatch(spell -> !spell.getSourceId().equals(source.getSourceId()) || spell.getZoneChangeCounter(game) != source.getSourceObjectZoneChangeCounter()); + .anyMatch(spell -> !spell.getSourceId().equals(source.getSourceId()) || spell.getZoneChangeCounter(game) != source.getStackMomentSourceZCC()); } public Hint getHint() { diff --git a/Mage/src/main/java/mage/abilities/condition/common/SourceDealtDamageCondition.java b/Mage/src/main/java/mage/abilities/condition/common/SourceDealtDamageCondition.java index 5512e058588..694e7bb5d06 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/SourceDealtDamageCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/SourceDealtDamageCondition.java @@ -22,7 +22,7 @@ public class SourceDealtDamageCondition implements Condition { @Override public boolean apply(Game game, Ability source) { DamageDoneWatcher watcher = game.getState().getWatcher(DamageDoneWatcher.class); - return watcher != null && watcher.damageDoneBy(source.getSourceId(), source.getSourceObjectZoneChangeCounter(), game) >= value; + return watcher != null && watcher.damageDoneBy(source.getSourceId(), source.getStackMomentSourceZCC(), game) >= value; } @Override diff --git a/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java b/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java index 62dd2fade0a..ad9f3fbae43 100644 --- a/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java +++ b/Mage/src/main/java/mage/abilities/costs/AlternativeCostSourceAbility.java @@ -203,7 +203,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter } private String getActivatedKey(Ability source) { - return getActivatedKey(this.getOriginalId(), source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + return getActivatedKey(this.getOriginalId(), source.getSourceId(), source.getStackMomentSourceZCC()); } private static String getActivatedKey(UUID alternativeCostOriginalId, UUID sourceId, int sourceZCC) { @@ -217,7 +217,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter } private String getDynamicCostActivatedKey(Ability source) { - return getDynamicCostActivatedKey(this.getOriginalId(), source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + return getDynamicCostActivatedKey(this.getOriginalId(), source.getSourceId(), source.getStackMomentSourceZCC()); } private static String getDynamicCostActivatedKey(UUID alternativeCostOriginalId, UUID sourceId, int sourceZCC) { @@ -243,7 +243,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter String key = getActivatedKey( alternativeCostOriginalId, source.getSourceId(), - source.getSourceObjectZoneChangeCounter() + (searchPrevZCC ? -1 : 0) + source.getStackMomentSourceZCC() + (searchPrevZCC ? -1 : 0) ); Boolean status = (Boolean) game.getState().getValue(key); return status != null && status; diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentPowerCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentPowerCount.java index 17a38a50c19..4550bc49500 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentPowerCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentPowerCount.java @@ -18,7 +18,7 @@ public enum AttachedPermanentPowerCount implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent attachmentPermanent = game.getPermanent(sourceAbility.getSourceId()); if (attachmentPermanent == null) { - attachmentPermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD, sourceAbility.getSourceObjectZoneChangeCounter()); + attachmentPermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD, sourceAbility.getStackMomentSourceZCC()); } if (attachmentPermanent == null || attachmentPermanent.getAttachedTo() == null) { return 0; diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentToughnessCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentToughnessCount.java index 35543b26778..080de1d6c09 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentToughnessCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/AttachedPermanentToughnessCount.java @@ -17,7 +17,7 @@ public enum AttachedPermanentToughnessCount implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent attachmentPermanent = game.getPermanent(sourceAbility.getSourceId()); if (attachmentPermanent == null) { - attachmentPermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD, sourceAbility.getSourceObjectZoneChangeCounter()); + attachmentPermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD, sourceAbility.getStackMomentSourceZCC()); } if (attachmentPermanent == null || attachmentPermanent.getAttachedTo() == null) { return 0; diff --git a/Mage/src/main/java/mage/abilities/effects/PreventDamageAndRemoveCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/PreventDamageAndRemoveCountersEffect.java index c9faecee202..d204f04b445 100644 --- a/Mage/src/main/java/mage/abilities/effects/PreventDamageAndRemoveCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/PreventDamageAndRemoveCountersEffect.java @@ -71,7 +71,7 @@ public class PreventDamageAndRemoveCountersEffect extends PreventionEffectImpl { if (permanent == null || watcher == null || damageAmount <= 0) { return false; } - MageObjectReference mor = new MageObjectReference(source.getId(), source.getSourceObjectZoneChangeCounter(), game); + MageObjectReference mor = new MageObjectReference(source.getId(), source.getStackMomentSourceZCC(), game); int beforeCount = permanent.getCounters(game).getCount(CounterType.P1P1); if (thatMany) { // Remove them. @@ -110,7 +110,7 @@ public class PreventDamageAndRemoveCountersEffect extends PreventionEffectImpl { if (whileHasCounter && !permanent.getCounters(game).containsKey(CounterType.P1P1)) { // If the last counter has already be removed for the same batch of prevention, we still want to prevent the damage. PreventDamageAndRemoveCountersWatcher watcher = game.getState().getWatcher(PreventDamageAndRemoveCountersWatcher.class); - MageObjectReference mor = new MageObjectReference(source.getId(), source.getSourceObjectZoneChangeCounter(), game); + MageObjectReference mor = new MageObjectReference(source.getId(), source.getStackMomentSourceZCC(), game); return watcher != null && watcher.hadMORCounterRemovedThisBatch(mor); } return true; @@ -149,4 +149,4 @@ class PreventDamageAndRemoveCountersWatcher extends Watcher { void addMOR(MageObjectReference mor) { morRemovedCounterThisDamageBatch.add(mor); } -} \ No newline at end of file +} diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java index eaadf209ab4..f464355448e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopyEffect.java @@ -86,7 +86,7 @@ public class CopyEffect extends ContinuousEffectImpl { return false; } // As long as the permanent is still in the short living LKI continue to copy to get triggered abilities to TriggeredAbilities for dies events. - permanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD, source.getSourceObjectZoneChangeCounter()); + permanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD, source.getStackMomentSourceZCC()); if (permanent == null) { discard(); return false; diff --git a/Mage/src/main/java/mage/abilities/effects/common/EntersBattlefieldUnderControlOfOpponentOfChoiceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/EntersBattlefieldUnderControlOfOpponentOfChoiceEffect.java index 643864d3466..52462ed7b1d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/EntersBattlefieldUnderControlOfOpponentOfChoiceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/EntersBattlefieldUnderControlOfOpponentOfChoiceEffect.java @@ -59,7 +59,7 @@ public class EntersBattlefieldUnderControlOfOpponentOfChoiceEffect extends OneSh Duration.Custom, true, opponent.getId() ); continuousEffect.setTargetPointer(new FixedTarget( - source.getSourceId(), source.getSourceObjectZoneChangeCounter() + source.getSourceId(), source.getStackMomentSourceZCC() )); game.addEffect(continuousEffect, source); return true; diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileFaceDownYouMayPlayAsLongAsExiledTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileFaceDownYouMayPlayAsLongAsExiledTargetEffect.java index 7763a00ee8c..176717e55eb 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileFaceDownYouMayPlayAsLongAsExiledTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileFaceDownYouMayPlayAsLongAsExiledTargetEffect.java @@ -73,7 +73,7 @@ public class ExileFaceDownYouMayPlayAsLongAsExiledTargetEffect extends OneShotEf return false; } // move card to exile - UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); MageObject sourceObject = source.getSourceObject(game); String exileName = sourceObject == null ? "" : sourceObject.getIdName(); for (Card card : cards.getCards(game)) { @@ -101,4 +101,4 @@ public class ExileFaceDownYouMayPlayAsLongAsExiledTargetEffect extends OneShotEf } return true; } -} \ No newline at end of file +} diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileSourceEffect.java index de5e9aba55a..69a78aae6de 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileSourceEffect.java @@ -1,6 +1,5 @@ package mage.abilities.effects.common; -import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; @@ -59,7 +58,7 @@ public class ExileSourceEffect extends OneShotEffect { UUID exileZoneId = null; String exileZoneName = ""; if (toUniqueExileZone) { - exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); exileZoneName = card.getName(); } return controller.moveCardsToExile(card, source, game, true, exileZoneId, exileZoneName); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileTargetEffect.java index edc5433bba3..1d88dd2a854 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileTargetEffect.java @@ -111,7 +111,7 @@ public class ExileTargetEffect extends OneShotEffect { } if (toSourceExileZone) { MageObject sourceObject = source.getSourceObject(game); - exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); if (sourceObject != null) { exileZone = sourceObject.getIdName(); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileTargetForSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileTargetForSourceEffect.java index 1b16ffdf372..11ece3e1bf3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileTargetForSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileTargetForSourceEffect.java @@ -78,7 +78,7 @@ public class ExileTargetForSourceEffect extends OneShotEffect { } } - UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); // it can target permanents on battlefield, so use objects first Set cardsToMove = objectsToMove.stream() diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromExileForSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromExileForSourceEffect.java index 0bcb084d1a0..267012e2c57 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnFromExileForSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnFromExileForSourceEffect.java @@ -66,7 +66,7 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect { if (permanentLeftBattlefield != null) { exileId = CardUtil.getExileZoneId(game, source.getSourceId(), permanentLeftBattlefield.getZoneChangeCounter(game)); } else { - exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + exileId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); } ExileZone exile = game.getExile().getExileZone(exileId); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlSourceEffect.java index 7bc72ac3174..15dc5590c6f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToBattlefieldUnderYourControlSourceEffect.java @@ -38,7 +38,7 @@ public class ReturnToBattlefieldUnderYourControlSourceEffect extends OneShotEffe if (controller == null) { return false; } - UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC()); ExileZone exileZone = game.getExile().getExileZone(exileZoneId); if (exileZone != null && exileZone.contains(source.getSourceId())) { Card card = game.getCard(source.getSourceId()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandSourceEffect.java index 29eaf85c47b..509ee503062 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ReturnToHandSourceEffect.java @@ -60,7 +60,7 @@ public class ReturnToHandSourceEffect extends OneShotEffect { } MageObject mageObject; if (returnFromNextZone - && game.getState().getZoneChangeCounter(source.getSourceId()) == source.getSourceObjectZoneChangeCounter() + 1) { + && game.getState().getZoneChangeCounter(source.getSourceId()) == source.getStackMomentSourceZCC() + 1) { mageObject = game.getObject(source); } else { mageObject = source.getSourceObjectIfItStillExists(game); diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java index c74c2318ea4..b6ab6a28099 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java @@ -41,7 +41,7 @@ public class SacrificeSourceEffect extends OneShotEffect { if (sourceObject == null) { // Check if the effect was installed by the spell the source was cast by (e.g. Necromancy), if not don't sacrifice the permanent if (game.getState().getZone(source.getSourceId()).equals(Zone.BATTLEFIELD) - && source.getSourceObjectZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(source.getSourceId())) { + && source.getStackMomentSourceZCC() + 1 == game.getState().getZoneChangeCounter(source.getSourceId())) { sourceObject = game.getPermanent(source.getSourceId()); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java index cc0039f6a44..eb1cc799df9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceUnlessPaysEffect.java @@ -76,7 +76,7 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect { } game.informPlayers(player.getLogName() + " chooses not to " + logMessage + " to prevent sacrifice effect"); - if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()) + if (source.getStackMomentSourceZCC() == game.getState().getZoneChangeCounter(source.getSourceId()) && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) { sourcePermanent.sacrifice(source, game); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/asthought/MayCastFromGraveyardAsAdventureEffect.java b/Mage/src/main/java/mage/abilities/effects/common/asthought/MayCastFromGraveyardAsAdventureEffect.java index 78b3c80b95c..7ffec5a4206 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/asthought/MayCastFromGraveyardAsAdventureEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/asthought/MayCastFromGraveyardAsAdventureEffect.java @@ -49,6 +49,6 @@ public class MayCastFromGraveyardAsAdventureEffect extends AsThoughEffectImpl { return sourceCard != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD - && source.getSourceObjectZoneChangeCounter() == sourceCard.getZoneChangeCounter(game); + && source.getStackMomentSourceZCC() == sourceCard.getZoneChangeCounter(game); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java index 358be527915..26fb56a60c8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/AddCountersSourceEffect.java @@ -110,8 +110,8 @@ public class AddCountersSourceEffect extends OneShotEffect { return false; } - if ((source.getSourceObjectZoneChangeCounter() == 0 // from static ability - || source.getSourceObjectZoneChangeCounter() == permanent.getZoneChangeCounter(game))) { // prevent to add counters to later source objects + if ((source.getStackMomentSourceZCC() == 0 // from static ability + || source.getStackMomentSourceZCC() == permanent.getZoneChangeCounter(game))) { // prevent to add counters to later source objects Counter newCounter = counter.copy(); int countersToAdd = amount.calculate(game, source, this); if (amount instanceof StaticValue || countersToAdd > 0) { diff --git a/Mage/src/main/java/mage/abilities/keyword/CraftAbility.java b/Mage/src/main/java/mage/abilities/keyword/CraftAbility.java index 3ba9690fb4d..70f36cad717 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CraftAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CraftAbility.java @@ -169,7 +169,7 @@ class CraftEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Card card = game.getCard(source.getSourceId()); - if (player == null || card == null || card.getZoneChangeCounter(game) != source.getSourceObjectZoneChangeCounter() + 1) { + if (player == null || card == null || card.getZoneChangeCounter(game) != source.getStackMomentSourceZCC() + 1) { return false; } game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE); diff --git a/Mage/src/main/java/mage/abilities/keyword/EscapeAbility.java b/Mage/src/main/java/mage/abilities/keyword/EscapeAbility.java index aa370c2649d..d841f172422 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EscapeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EscapeAbility.java @@ -101,7 +101,7 @@ public class EscapeAbility extends SpellAbility { @Override public boolean activate(Game game, Set allowedIdentifiers, boolean noMana) { if (super.activate(game, allowedIdentifiers, noMana)) { - game.getState().setValue(CASTED_WITH_ESCAPE_KEY + getSourceId().toString() + (getSourceObjectZoneChangeCounter() + 1), Boolean.TRUE); + game.getState().setValue(CASTED_WITH_ESCAPE_KEY + getSourceId().toString() + (getStackMomentSourceZCC() + 1), Boolean.TRUE); return true; } return false; diff --git a/Mage/src/main/java/mage/abilities/keyword/JumpStartAbility.java b/Mage/src/main/java/mage/abilities/keyword/JumpStartAbility.java index 12270fcb6d5..d30d6a8a665 100644 --- a/Mage/src/main/java/mage/abilities/keyword/JumpStartAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/JumpStartAbility.java @@ -126,7 +126,7 @@ class JumpStartReplacementEffect extends ReplacementEffectImpl { if (event.getTargetId().equals(source.getSourceId()) && ((ZoneChangeEvent) event).getFromZone() == Zone.STACK && ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) { - return game.getState().getZoneChangeCounter(source.getSourceId()) == source.getSourceObjectZoneChangeCounter() + 1; + return game.getState().getZoneChangeCounter(source.getSourceId()) == source.getStackMomentSourceZCC() + 1; } return false; diff --git a/Mage/src/main/java/mage/abilities/keyword/MadnessAbility.java b/Mage/src/main/java/mage/abilities/keyword/MadnessAbility.java index 7297698bac1..d4e5dc7d20c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MadnessAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MadnessAbility.java @@ -280,7 +280,7 @@ enum MadnessCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - MageObject madnessSpell = game.getLastKnownInformation(source.getSourceId(), Zone.STACK, source.getSourceObjectZoneChangeCounter() - 1); + MageObject madnessSpell = game.getLastKnownInformation(source.getSourceId(), Zone.STACK, source.getStackMomentSourceZCC() - 1); if (!(madnessSpell instanceof Spell)) { return false; } diff --git a/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java b/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java index 7333596bb50..c5a4e2ecbca 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java @@ -87,7 +87,7 @@ class UnearthDelayedTriggeredAbility extends DelayedTriggeredAbility { } // The delayed trigger source is the card in the graveyard. // So we need to exile the zcc + 1 permanent - MageObjectReference object = new MageObjectReference(getSourceId(), getSourceObjectZoneChangeCounter() + 1, game); + MageObjectReference object = new MageObjectReference(getSourceId(), getStackMomentSourceZCC() + 1, game); Permanent permanent = object.getPermanent(game); if (permanent == null || !permanent.isPhasedIn()) { // Triggers, but do nothing. @@ -131,7 +131,7 @@ class UnearthLeavesBattlefieldEffect extends ReplacementEffectImpl { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() != Zone.EXILED) { // Only move it to exile if it was this instance that was moved to battlefield with unearth - return source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()); + return source.getStackMomentSourceZCC() == game.getState().getZoneChangeCounter(source.getSourceId()); } } return false; diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/SaddledSourceThisTurnPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/SaddledSourceThisTurnPredicate.java index f150d8244ea..77ed2d89118 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/SaddledSourceThisTurnPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/SaddledSourceThisTurnPredicate.java @@ -18,7 +18,7 @@ public enum SaddledSourceThisTurnPredicate implements ObjectSourcePlayerPredicat @Override public boolean apply(ObjectSourcePlayer input, Game game) { // for delayed triggers must use starting zcc (when delayed trigger created) - MageObjectReference startingMor = new MageObjectReference(input.getSourceId(), input.getSource().getSourceObjectZoneChangeCounter(), game); + MageObjectReference startingMor = new MageObjectReference(input.getSourceId(), input.getSource().getStackMomentSourceZCC(), game); return SaddledMountWatcher.checkIfSaddledThisTurn(input.getObject(), startingMor, game); } diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 978171210d6..62a2b2f17cd 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -2264,7 +2264,7 @@ public abstract class GameImpl implements Game { // // There are two possibility for the zcc: // 1/ the source is an Ability with a valid (not 0) zcc, and we must use the same. - int zcc = source.getSourceObjectZoneChangeCounter(); + int zcc = source.getStackMomentSourceZCC(); if (zcc == 0) { // 2/ the source has not a valid zcc (it is most likely a StaticAbility instantiated at beginning of game) // we use the source objects's zcc diff --git a/Mage/src/main/java/mage/game/stack/StackAbility.java b/Mage/src/main/java/mage/game/stack/StackAbility.java index a6f80c416c1..66211b60147 100644 --- a/Mage/src/main/java/mage/game/stack/StackAbility.java +++ b/Mage/src/main/java/mage/game/stack/StackAbility.java @@ -678,8 +678,8 @@ public class StackAbility extends StackObjectImpl implements Ability { ability.initSourceObjectZoneChangeCounter(game, force); } @Override - public int getSourceObjectZoneChangeCounter() { - return ability.getSourceObjectZoneChangeCounter(); + public int getStackMomentSourceZCC() { + return ability.getStackMomentSourceZCC(); } @Override diff --git a/Mage/src/main/java/mage/util/CardUtil.java b/Mage/src/main/java/mage/util/CardUtil.java index abc4f0bbe53..65a79575a4b 100644 --- a/Mage/src/main/java/mage/util/CardUtil.java +++ b/Mage/src/main/java/mage/util/CardUtil.java @@ -615,7 +615,7 @@ public final class CardUtil { } public static UUID getExileZoneId(Game game, Ability source, int offset) { - return getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter() + offset); + return getExileZoneId(game, source.getSourceId(), source.getStackMomentSourceZCC() + offset); } public static UUID getExileZoneId(Game game, UUID objectId, int zoneChangeCounter) { @@ -758,7 +758,7 @@ public final class CardUtil { MageObject sourceObject = game.getObject(source); if (sourceObject != null) { title = sourceObject.getIdName() - + " [" + source.getSourceObjectZoneChangeCounter() + "]" + + " [" + source.getStackMomentSourceZCC() + "]" + (textSuffix == null ? "" : " " + textSuffix); } else { title = textSuffix == null ? "" : textSuffix; @@ -1812,7 +1812,7 @@ public final class CardUtil { */ public static int getActualSourceObjectZoneChangeCounter(Game game, Ability source) { // current object zcc, find from source object (it can be permanent or spell on stack) - int zcc = source.getSourceObjectZoneChangeCounter(); + int zcc = source.getStackMomentSourceZCC(); if (zcc == 0) { // if ability is not activated yet then use current object's zcc (example: triggered etb ability checking the kicker conditional) zcc = game.getState().getZoneChangeCounter(source.getSourceId()); diff --git a/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java b/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java index d97285e86dc..259a0b6588d 100644 --- a/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/SpellsCastWatcher.java @@ -86,7 +86,7 @@ public class SpellsCastWatcher extends Watcher { .map(Spell::getCard) .map(Card::getMainCard) .anyMatch(card -> card.getId().equals(source.getSourceId()) - && card.getZoneChangeCounter(game) == source.getSourceObjectZoneChangeCounter())) { + && card.getZoneChangeCounter(game) == source.getStackMomentSourceZCC())) { return entry.getKey(); } }