@Override public void adjustTargets(Ability ability, Game game) { Card card = game.getCard(ability.getSourceId()); if (card != null) { card.adjustTargets(ability, game); } }
@Override public boolean applies(Ability abilityToModify, Ability source, Game game) { if (abilityToModify instanceof SpellAbility) { Card card = game.getCard(abilityToModify.getSourceId()); if (card != null && !card.isArtifact()) { 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) { for (AlternativeCost2 cost : evokeCosts) { if (cost.isActivated(game)) { return true; } } } return false; }
public SourceHasRemainedInSameZoneCondition(UUID idToCheck, Game game) { this.idToCheck = idToCheck; this.timesChangedZones = -1; if (this.idToCheck != null && game != null && game.getCard(this.idToCheck) != null) { this.timesChangedZones = game.getState().getZoneChangeCounter(this.idToCheck); } }
@Override public boolean applies(Ability abilityToModify, Ability source, Game game) { if ((abilityToModify instanceof SpellAbility) && abilityToModify.getSourceId().equals(source.getSourceId())) { return game.getCard(abilityToModify.getSourceId()) != null; } return false; }
@Override public boolean applies(Ability abilityToModify, Ability source, Game game) { return abilityToModify instanceof SpellAbility && abilityToModify.getSourceId().equals(source.getSourceId()) && game.getCard(abilityToModify.getSourceId()) != null; }
@Override public boolean applies(Ability abilityToModify, Ability source, Game game) { if ((abilityToModify instanceof SpellAbility) && abilityToModify.getSourceId().equals(source.getSourceId())) { return game.getCard(abilityToModify.getSourceId()) != null; } return false; }
@Override public boolean applies(Ability abilityToModify, Ability source, Game game) { return abilityToModify instanceof SpellAbility && abilityToModify.getSourceId().equals(source.getSourceId()) && game.getCard(abilityToModify.getSourceId()) != null; }
private void activateEvoke(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("Evoke source card not found"); } } }
@Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { if (getTargetPointer().getTargets(game, source).contains(objectId) && source.isControlledBy(affectedControllerId)) { Card card = game.getCard(objectId); if (card != null) { return true; } } return false; } }
@Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { if (getTargetPointer().getTargets(game, source).contains(objectId) && source.isControlledBy(affectedControllerId)) { Card card = game.getCard(objectId); if (card != null) { return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Card card = game.getCard(source.getSourceId()); if (card != null) { return card.getAbilities().stream() .filter(ab -> ab instanceof EvokeAbility) .anyMatch(evoke -> ((EvokeAbility) evoke).isActivated(source, game)); } return false; } }
@Override public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { Card card = game.getCard(objectId); if (card != null && affectedControllerId.equals(card.getOwnerId()) && game.getState().getZone(card.getId()) == Zone.EXILED) { return true; } return false; } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) { Card card = game.getCard(event.getTargetId()); if (card != null && game.getOpponents(source.getControllerId()).contains(card.getOwnerId())) { return true; } } return false; }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); Card card = game.getCard(this.cardId); if (controller != null && card != null) { controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true); return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(getSourceId())) { Card card = game.getCard(getSourceId()); if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD && card.getCounters(game).getCount(CounterType.REPAIR) == 0) { return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); Card card = game.getCard(cardId); if (permanent != null && card != null) { for (ActivatedAbility ability : card.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) { permanent.addAbility(ability, source.getSourceId(), game); } } return false; } }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (card != null) { controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } if (controller.searchLibrary(target, game)) { controller.moveCards(game.getCard(target.getFirstTarget()), Zone.GRAVEYARD, source, game); } controller.shuffleLibrary(source, game); return true; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (controller != null && card != null) { if (controller.chooseUse(Outcome.PlayForFree, "Play " + card.getIdName() + " without paying its mana cost?", source, game)) { controller.playCard(card, game, true, true, new MageObjectReference(source.getSourceObject(game), game)); } return true; } return false; }