public MnemonicBetrayalCastFromExileEffect(Card card, Game game) { super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit); this.card = card; this.zoneCounter = card.getZoneChangeCounter(game) + 1; }
@Override public UUID getFirst(Game game, Ability source) { // check target not changed zone if (this.zoneChangeCounter > 0) { // will be zero if not defined in init Card card = game.getCard(targetId); if (card != null && card.getZoneChangeCounter(game) != this.zoneChangeCounter) { return null; } } return targetId; }
public boolean isCardCastWithThisSavageSummoning(Card card, UUID cardId, int zoneChangeCounter, Game game) { String creatureCardKey = card.getId().toString() + '_' + (card.getZoneChangeCounter(game)); // add one because card is now gone to battlefield as creature String cardKey = cardId.toString() + '_' + zoneChangeCounter; Set<String> savageSpells = cardsCastWithSavageSummoning.get(creatureCardKey); return savageSpells != null && savageSpells.contains(cardKey); }
@Override public void updateZoneChangeCounter(Game game, ZoneChangeEvent event) { card.updateZoneChangeCounter(game, event); zoneChangeCounter = card.getZoneChangeCounter(game); }
public Card getCard(Game game) { Card card = game.getCard(sourceId); if (card != null && card.getZoneChangeCounter(game) == zoneChangeCounter) { return card; } return null; }
@Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { if (card.getZoneChangeCounter(game) != zoneCounter) { this.discard(); return false; } return objectId.equals(card.getId()) && card.getZoneChangeCounter(game) == zoneCounter && affectedControllerId.equals(source.getControllerId()); } }
public static String getCardZoneString(String text, UUID cardId, Game game, boolean previous) { int zoneChangeCounter = 0; Card card = game.getCard(cardId); // if called for a token, the id is enough if (card != null) { zoneChangeCounter = card.getZoneChangeCounter(game); } return getObjectZoneString(text, cardId, game, zoneChangeCounter, previous); }
@Override public boolean isActivated(Ability ability, Game game) { Card card = game.getCard(sourceId); if (card != null && card.getZoneChangeCounter(game) <= zoneChangeCounter + 1) { for (AlternativeCost2 cost : alternativeSourceCosts) { if (cost.isActivated(game)) { return true; } } } return false; }
@Override public boolean isActivated(Ability ability, Game game) { Card card = game.getCard(sourceId); if (card != null && card.getZoneChangeCounter(game) <= zoneChangeCounter + 1) { return alternateCosts.isActivated(game); } return false; }
public void setBottomHalfCard(Card bottomHalfCard, Game game) { this.bottomHalfCard = bottomHalfCard; this.bottomLastZoneChangeCounter = bottomHalfCard.getZoneChangeCounter(game); halves.add(bottomHalfCard.getId()); }
private void activateDash(AlternativeCost2 cost, Game game) { cost.activate(); // remember zone change counter if (zoneChangeCounter == 0) { Card card = game.getCard(getSourceId()); if (card != null) { zoneChangeCounter = card.getZoneChangeCounter(game); } else { throw new IllegalArgumentException("Dash source card not found"); } } }
private void activateMorph(Game game) { alternateCosts.activate(); // remember zone change counter if (zoneChangeCounter == 0) { Card card = game.getCard(getSourceId()); if (card != null) { zoneChangeCounter = card.getZoneChangeCounter(game); } else { throw new IllegalArgumentException("Morph source card not found"); } } }
public boolean hasTopHalf(Game game) { boolean value = topLastZoneChangeCounter == topHalfCard.getZoneChangeCounter(game) && halves.contains(topHalfCard.getId()); if (!value) { halves.remove(topHalfCard); } return value; }
public boolean hasBottomHalf(Game game) { boolean value = bottomLastZoneChangeCounter == bottomHalfCard.getZoneChangeCounter(game) && halves.contains(bottomHalfCard.getId()); if (!value) { halves.remove(bottomHalfCard); } return value; }
@Override public void init(Ability source, Game game) { watcher = game.getState().getWatcher(SavageSummoningWatcher.class, source.getControllerId()); Card card = game.getCard(source.getSourceId()); if (watcher == null || card == null) { throw new IllegalArgumentException("Consume Savage watcher or card could not be found"); } this.zoneChangeCounter = card.getZoneChangeCounter(game); }
@Override public void init(Ability source, Game game) { watcher = game.getState().getWatcher(SavageSummoningWatcher.class, source.getControllerId()); Card card = game.getCard(source.getSourceId()); if (watcher == null || card == null) { throw new IllegalArgumentException("Consume Savage watcher or card could not be found"); } this.zoneChangeCounter = card.getZoneChangeCounter(game); }
public PermanentCard(Card card, UUID controllerId, Game game) { super(card.getId(), card.getOwnerId(), controllerId, card.getName()); this.card = card; this.zoneChangeCounter = card.getZoneChangeCounter(game); // local value already set to the raised number init(card, game); }
@Override public void init(Game game, Ability source) { if (source.getTargets().size() > 1) { for (UUID target : source.getTargets().get(1).getTargets()) { Card card = game.getCard(target); if (card != null) { this.zoneChangeCounter.put(target, card.getZoneChangeCounter(game)); } } } }
@Override public void init(Ability source, Game game) { watcher = game.getState().getWatcher(ScoutsWarningWatcher.class, source.getControllerId()); Card card = game.getCard(source.getSourceId()); if (watcher != null && card != null) { zoneChangeCounter = card.getZoneChangeCounter(game); watcher.addScoutsWarningSpell(source.getSourceId(), zoneChangeCounter); } }
@Override public void init(Ability source, Game game) { quickenWatcher = game.getState().getWatcher(QuickenWatcher.class); Card card = game.getCard(source.getSourceId()); if (quickenWatcher != null && card != null) { zoneChangeCounter = card.getZoneChangeCounter(game); quickenWatcher.addQuickenSpell(source.getControllerId(), source.getSourceId(), zoneChangeCounter); } }