@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null) { paid = permanent.tap(game); } return paid; }
@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent attachment = game.getPermanentOrLKIBattlefield(sourceId); Permanent permanent = game.getPermanent(attachment.getAttachedTo()); if (permanent != null) { paid = permanent.tap(game); } return paid; }
@Override public boolean apply(Game game, Ability source) { Permanent attachment = game.getPermanent(source.getSourceId()); if (attachment == null || attachment.getAttachedTo() == null) { return false; } Permanent attachedTo = game.getPermanent(attachment.getAttachedTo()); return (attachedTo != null); } }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Permanent attachment = game.getPermanentOrLKIBattlefield(sourceId); Permanent permanent = game.getPermanent(attachment.getAttachedTo()); if (permanent != null) { // return true; // Technically the more correct implementation, but all cards using this cost also come with an "untapped" condition return !permanent.isTapped(); } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanent(event.getTargetId()); return land.getControllerId().equals(controllerId); }
@Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); if(enchantment == null) { return false; } Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); return enchanted != null && event.getTargetId().equals(enchanted.getId()); }
@Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { Permanent permanent = game.getPermanent(sourceId); Player controller = game.getPlayer(controllerId); if (permanent == null || controller == null) { return false; } controller.moveCards(permanent, Zone.HAND, ability, game); paid = true; return paid; }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Permanent permanent = game.getPermanent(sourceId); return permanent != null && permanent.getCounters(game).getCount(name) >= amount; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getTargetId().equals(this.getSourceId())) { Permanent attachment = game.getPermanent(event.getSourceId()); if (attachment != null && attachment.hasSubtype(SubType.AURA, game)) { return true; } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(this.getControllerId())) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null && permanent.isEnchantment()) { return true; } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { boolean weAreExerting = isControlledBy(event.getPlayerId()); Permanent exerted = game.getPermanent(event.getTargetId()); boolean exertedIsCreature = (exerted != null) && exerted.isCreature(); return weAreExerting && exertedIsCreature; }
@Override public void init(Ability source, Game game) { super.init(source, game); for (FixedTarget fixedTarget : this.detainedObjects) { Permanent permanent = game.getPermanent(fixedTarget.getFirst(game, source)); if (permanent != null) { permanent.addInfo("detain" + getId(), "[Detained]", game); } } }
@Override public boolean apply(Game game, Ability source) { if (!source.getTargets().isEmpty()) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { return permanent.hasSubtype(subtype, game); } } return false; } }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent sourcePermanent = game.getPermanent(sourceAbility.getSourceId()); if (sourcePermanent == null) { sourcePermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD); } if (sourcePermanent != null) { return sourcePermanent.getToughness().getValue(); } return 0; }
@Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source.getSourceId()); Permanent permanentToUntap = game.getPermanent((event.getTargetId())); if (permanentToUntap != null && mageObject != null) { return permanentToUntap.getLogName() + " doesn't untap (" + mageObject.getLogName() + ')'; } return null; }
@Override public void init(Ability source, Game game) { super.init(source, game); for (UUID targetId : this.getTargetPointer().getTargets(game, source)) { Permanent permanent = game.getPermanent(targetId); if (permanent != null) { permanent.addInfo("detain" + getId(), CardUtil.addToolTipMarkTags("Detained"), game); } } }
@Override public boolean checkTrigger(GameEvent event, Game game) { Permanent sourcePermanent = game.getPermanent(event.getSourceId()); if (sourcePermanent != null && filter.match(sourcePermanent, sourceId, controllerId, game)) { if (setTargetPointer) { this.getEffects().setTargetPointer(new FixedTarget(event.getSourceId())); } return true; } return false; }
public void exileTokensCreatedAtNextEndStep(Game game, Ability source) { for (UUID tokenId : this.getLastAddedTokenIds()) { Permanent tokenPermanent = game.getPermanent(tokenId); if (tokenPermanent != null) { ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD); exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game)); game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect), source); } } }
@Override public boolean checkTrigger(GameEvent event, Game game) { Permanent p = game.getPermanent(event.getTargetId()); if (p != null && p.isTapped() && p.isControlledBy(this.controllerId)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); } return true; } return false; }
@Override public Permanent getSourcePermanentOrLKI(Game game) { if (getSourceObjectZoneChangeCounter() == 0 || getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(getSourceId())) { return game.getPermanent(getSourceId()); } return (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD, getSourceObjectZoneChangeCounter()); }