From e5dd3aa05d7576576faf6e50b8a2bb2861116233 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 22 Apr 2020 21:18:28 -0400 Subject: [PATCH] ok but for real this time --- .../src/mage/cards/h/HaldanAvidArcanist.java | 2 +- .../src/mage/cards/p/PakoArcaneRetriever.java | 48 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Mage.Sets/src/mage/cards/h/HaldanAvidArcanist.java b/Mage.Sets/src/mage/cards/h/HaldanAvidArcanist.java index a6e278f068..e946f7fff6 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, new PakoArcaneRetriever.PakoArcaneRetrieverWatcher()); + this.addAbility(ability); } 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 a90a2809ae..c8f310bb38 100644 --- a/Mage.Sets/src/mage/cards/p/PakoArcaneRetriever.java +++ b/Mage.Sets/src/mage/cards/p/PakoArcaneRetriever.java @@ -58,30 +58,6 @@ public final class PakoArcaneRetriever extends CardImpl { 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 { @@ -129,3 +105,27 @@ 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 card != null && playerMap + .computeIfAbsent(playerId, u -> new HashSet()) + .stream() + .anyMatch(mageObjectReference -> mageObjectReference.refersTo(card.getId(), game)); + } +}