diff --git a/Mage.Sets/src/mage/cards/h/HaldanAvidArcanist.java b/Mage.Sets/src/mage/cards/h/HaldanAvidArcanist.java index 278edcae98e..0922bcbf4ef 100644 --- a/Mage.Sets/src/mage/cards/h/HaldanAvidArcanist.java +++ b/Mage.Sets/src/mage/cards/h/HaldanAvidArcanist.java @@ -48,6 +48,16 @@ public final class HaldanAvidArcanist extends CardImpl { public HaldanAvidArcanist copy() { return new HaldanAvidArcanist(this); } + + static boolean checkCard(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { + if (!PakoArcaneRetriever.checkWatcher(affectedControllerId, game.getCard(sourceId), game) + || !source.isControlledBy(affectedControllerId) + || game.getState().getZone(sourceId) != Zone.EXILED) { + return false; + } + Card card = game.getCard(sourceId); + return card != null && !card.isCreature() && card.getCounters(game).containsKey(CounterType.FETCH); + } } class HaldanAvidArcanistCastFromExileEffect extends AsThoughEffectImpl { @@ -73,13 +83,7 @@ class HaldanAvidArcanistCastFromExileEffect extends AsThoughEffectImpl { @Override public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { - if (!PakoArcaneRetriever.checkWatcher(affectedControllerId, game.getCard(sourceId), game) - || !source.isControlledBy(affectedControllerId) - || game.getState().getZone(sourceId) != Zone.EXILED) { - return false; - } - Card card = game.getCard(sourceId); - return card != null && !card.isCreature() && card.getCounters(game).containsKey(CounterType.FETCH); + return HaldanAvidArcanist.checkCard(sourceId, source, affectedControllerId, game); } } @@ -106,13 +110,7 @@ class HaldanAvidArcanistSpendAnyManaEffect extends AsThoughEffectImpl implements @Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { - if (!PakoArcaneRetriever.checkWatcher(affectedControllerId, game.getCard(objectId), game) - || !source.isControlledBy(affectedControllerId) - || game.getState().getZone(objectId) != Zone.EXILED) { - return false; - } - Card card = game.getCard(objectId); - return card != null && !card.isCreature() && card.getCounters(game).containsKey(CounterType.FETCH); + return HaldanAvidArcanist.checkCard(objectId, source, affectedControllerId, game); } @Override diff --git a/Mage.Sets/src/mage/cards/p/PakoArcaneRetriever.java b/Mage.Sets/src/mage/cards/p/PakoArcaneRetriever.java index c8f310bb387..c0b8a7ce639 100644 --- a/Mage.Sets/src/mage/cards/p/PakoArcaneRetriever.java +++ b/Mage.Sets/src/mage/cards/p/PakoArcaneRetriever.java @@ -80,7 +80,8 @@ class PakoArcaneRetrieverEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller == null) { + PakoArcaneRetrieverWatcher watcher = game.getState().getWatcher(PakoArcaneRetrieverWatcher.class); + if (controller == null || watcher == null) { return false; } Cards cards = new CardsImpl(); @@ -97,7 +98,11 @@ class PakoArcaneRetrieverEffect extends OneShotEffect { if (cards.isEmpty()) { return true; } - cards.getCards(game).stream().forEach(card -> card.addCounters(CounterType.FETCH.createInstance(), source, game)); + cards.getCards(game) + .stream() + .filter(card -> card.addCounters(CounterType.FETCH.createInstance(), source, game)) + .filter(card -> !card.isCreature()) + .forEach(card -> watcher.addCard(controller.getId(), card, game)); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null || counters == 0) { return true;