fixed Haldan and Pako (fixes #6482)

This commit is contained in:
Evan Kranzler 2020-04-27 18:08:44 -04:00
parent 237babc5e8
commit ae20bb36a4
2 changed files with 19 additions and 16 deletions

View file

@ -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

View file

@ -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;