diff --git a/Mage.Sets/src/mage/cards/h/HaldanAvidArcanist.java b/Mage.Sets/src/mage/cards/h/HaldanAvidArcanist.java index 45451403a4..a6e278f068 100644 --- a/Mage.Sets/src/mage/cards/h/HaldanAvidArcanist.java +++ b/Mage.Sets/src/mage/cards/h/HaldanAvidArcanist.java @@ -37,7 +37,7 @@ public final class HaldanAvidArcanist extends CardImpl { // You may play noncreature cards from exile with fetch counters on them if you exiled them, and you may spend mana as though it were mana of any color to cast those spells. Ability ability = new SimpleStaticAbility(new HaldanAvidArcanistCastFromExileEffect()); ability.addEffect(new HaldanAvidArcanistSpendAnyManaEffect()); - this.addAbility(ability, PakoArcaneRetriever.makeWatcher()); + this.addAbility(ability, new PakoArcaneRetriever.PakoArcaneRetrieverWatcher()); } private HaldanAvidArcanist(final HaldanAvidArcanist card) { diff --git a/Mage.Sets/src/mage/cards/p/PakoArcaneRetriever.java b/Mage.Sets/src/mage/cards/p/PakoArcaneRetriever.java index 8dc54259a5..a90a2809ae 100644 --- a/Mage.Sets/src/mage/cards/p/PakoArcaneRetriever.java +++ b/Mage.Sets/src/mage/cards/p/PakoArcaneRetriever.java @@ -54,14 +54,34 @@ public final class PakoArcaneRetriever extends CardImpl { return new PakoArcaneRetriever(this); } - public static PakoArcaneRetrieverWatcher makeWatcher() { - return new PakoArcaneRetrieverWatcher(); - } - public static boolean checkWatcher(UUID playerId, Card card, Game game) { PakoArcaneRetrieverWatcher watcher = game.getState().getWatcher(PakoArcaneRetrieverWatcher.class); return watcher != null && watcher.checkCard(playerId, card, game); } + + public static class PakoArcaneRetrieverWatcher extends Watcher { + + private final Map> playerMap = new HashMap(); + + public PakoArcaneRetrieverWatcher() { + super(WatcherScope.GAME); + } + + @Override + public void watch(GameEvent event, Game game) { + } + + void addCard(UUID playerId, Card card, Game game) { + playerMap.computeIfAbsent(playerId, u -> new HashSet()).add(new MageObjectReference(card, game)); + } + + private boolean checkCard(UUID playerId, Card card, Game game) { + return playerMap + .computeIfAbsent(playerId, u -> new HashSet()) + .stream() + .anyMatch(mageObjectReference -> mageObjectReference.refersTo(card, game)); + } + } } class PakoArcaneRetrieverEffect extends OneShotEffect { @@ -109,27 +129,3 @@ class PakoArcaneRetrieverEffect extends OneShotEffect { return permanent.addCounters(CounterType.P1P1.createInstance(counters), source, game); } } - -class PakoArcaneRetrieverWatcher extends Watcher { - - private final Map> playerMap = new HashMap(); - - PakoArcaneRetrieverWatcher() { - super(WatcherScope.GAME); - } - - @Override - public void watch(GameEvent event, Game game) { - } - - void addCard(UUID playerId, Card card, Game game) { - playerMap.computeIfAbsent(playerId, u -> new HashSet()).add(new MageObjectReference(card, game)); - } - - boolean checkCard(UUID playerId, Card card, Game game) { - return playerMap - .computeIfAbsent(playerId, u -> new HashSet()) - .stream() - .anyMatch(mageObjectReference -> mageObjectReference.refersTo(card, game)); - } -} \ No newline at end of file