@Override public UUID getOwnerId() { return card.getOwnerId(); }
default boolean isOwnedBy(UUID controllerId){ return getOwnerId().equals(controllerId); } }
@Override public final boolean apply(Card input, Game game) { if(input.getConvertedManaCost() <= game.getBattlefield().getAllActivePermanents(new FilterControlledLandPermanent(), input.getOwnerId(), game).size()){ return true; } 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 checkTrigger(GameEvent event, Game game) { if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) { Card card = game.getCard(event.getTargetId()); if (card != null && card.isCreature() && game.getOpponents(controllerId).contains(card.getOwnerId())) { 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; }
public void putOnBottom(Card card, Game game) { if (card.isOwnedBy(playerId)) { card.setZone(Zone.LIBRARY, game); library.remove(card.getId()); library.add(card.getId()); } else { game.getPlayer(card.getOwnerId()).getLibrary().putOnBottom(card, game); } }
@Override public boolean putInGraveyard(Card card, Game game) { if (card.isOwnedBy(playerId)) { this.graveyard.add(card); } else { return game.getPlayer(card.getOwnerId()).putInGraveyard(card, game); } return true; }
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 boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { for (Card card : game.getExile().getAllCards(game)) { if (controller.hasOpponent(card.getOwnerId(), game)) { return true; } } } return false; }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Card card = game.getCard(source.getSourceId()); if (card != null) { Player owner = game.getPlayer(card.getOwnerId()); if (owner != null) { if (owner.moveCards(card, Zone.BATTLEFIELD, source, game)) { return true; } } } return false; }
public void putOnTop(Card card, Game game) { if (card.isOwnedBy(playerId)) { card.setZone(Zone.LIBRARY, game); library.addFirst(card.getId()); } else { game.getPlayer(card.getOwnerId()).getLibrary().putOnTop(card, game); } }
@Override public boolean canTarget(UUID id, Ability source, Game game) { UUID firstTarget = this.getFirstTarget(); if (firstTarget != null) { Card card = game.getCard(firstTarget); Card targetCard = game.getCard(id); if (card == null || targetCard == null || !card.isOwnedBy(targetCard.getOwnerId())) { return false; } } return super.canTarget(id, source, game); }
public CastCommanderAbility(Card card) { super(card.getManaCost(), card.getName(), Zone.COMMAND, SpellAbilityType.BASE); this.costs = card.getSpellAbility().getCosts().copy(); this.timing = TimingRule.SORCERY; this.usesStack = true; this.controllerId = card.getOwnerId(); this.sourceId = card.getId(); }
@Override public boolean applies(GameEvent event, Ability source, Game game) { Card card = game.getCard(event.getSourceId()); if (card != null) { Spell spell = game.getState().getStack().getSpell(event.getSourceId()); if (spell != null && spell.isFaceDown(game)) { return false; // Face Down cast spell (Morph creature) has no name } return CardUtil.haveSameNames(card.getName(), creatureName) && Objects.equals(ownerId, card.getOwnerId()); } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getToZone() == Zone.GRAVEYARD && zEvent.getFromZone() == Zone.BATTLEFIELD) { Card card = game.getCard(zEvent.getTargetId()); Player controller = game.getPlayer(getControllerId()); return card != null && controller != null && controller.hasOpponent(card.getOwnerId(), game); } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (((ZoneChangeEvent)event).isDiesEvent()) { Card card = game.getPermanentOrLKIBattlefield(event.getTargetId()); Player controller = game.getPlayer(getControllerId()); if (controller != null && card != null && card.isArtifact() && controller.hasOpponent(card.getOwnerId(), game)) { return true; } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.GRAVEYARD) { Card card = game.getCard(zEvent.getTargetId()); Player controller = game.getPlayer(getControllerId()); return card != null && card.isCreature() && controller != null && controller.hasOpponent(card.getOwnerId(), game); } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Card target = (Card) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK); if (target != null) { Player controller = game.getPlayer(target.getOwnerId()); if (controller != null && player != null) { player.lookAtCards("Lay Bare", controller.getHand(), game); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Card card = game.getCard(objectToReturn.getSourceId()); if (card != null && objectToReturn.refersTo(card, game)) { Player owner = game.getPlayer(card.getOwnerId()); if (owner != null) { game.addEffect(new OtherworldlyJourneyEntersBattlefieldEffect(objectToReturn), source); owner.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null); } } return true; } }