ok but for real this time

This commit is contained in:
Evan Kranzler 2020-04-22 21:18:28 -04:00
parent 1756c1f754
commit e5dd3aa05d
2 changed files with 25 additions and 25 deletions

View file

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

View file

@ -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<UUID, Set<MageObjectReference>> 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<UUID, Set<MageObjectReference>> 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<MageObjectReference>())
.stream()
.anyMatch(mageObjectReference -> mageObjectReference.refersTo(card.getId(), game));
}
}