@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); MageObject mageObject = game.getObject(source.getSourceId()); if (player != null && mageObject != null) { String message = userMessage; if (message == null) { message = getCostText() + " to prevent " + executingEffect.getText(source.getModes().getMode()) + "?"; } message = CardUtil.replaceSourceName(message, mageObject.getLogName()); cost.clearPaid(); if (cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(executingEffect.getOutcome(), message, source, game)) { cost.pay(source, game, source.getSourceId(), player.getId(), false, null); } if (!cost.isPaid()) { executingEffect.setTargetPointer(this.targetPointer); return executingEffect.apply(game, source); } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = getPayingPlayer(game, source); MageObject mageObject = game.getObject(source.getSourceId()); if (player != null && mageObject != null) { String message; if (chooseUseText == null) { message = new StringBuilder(getCostText()) .append(" and ") .append(executingEffect.getText(source.getModes().getMode())) .append("?") .toString(); } else { message = chooseUseText; } message = CardUtil.replaceSourceName(message, mageObject.getName()); if (cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(executingEffect.getOutcome(), message, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) { executingEffect.setTargetPointer(this.targetPointer); if (executingEffect instanceof OneShotEffect) { if (!(executingEffect instanceof PostResolveEffect)) { return executingEffect.apply(game, source); } } else { game.addEffect((ContinuousEffect) executingEffect, source); } } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Cost cost = new GenericManaCost(1); cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { super.apply(game, source); } return true; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (player != null && permanent != null) { if (player.chooseUse( Outcome.Benefit, "Pay " + cost.getText() /* + " or sacrifice " + permanent.getName() */ + "?", game)) { cost.clearPaid(); if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) return true; } permanent.sacrifice(source.getSourceId(), game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Cost cost = new GenericManaCost(1); cost.clearPaid(); if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { permanent.damage(1, source.getId(), game, true, false); return true; } Player player = game.getPlayer(source.getFirstTarget()); if (player != null) { player.damage(1, source.getSourceId(), game, false, true); return true; } return false; } return false; }
protected static int playerPaysXGenericMana(Player player, Ability source, Game game) { int xValue = 0; boolean payed = false; while (player.canRespond() && !payed) { xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source); if (xValue > 0) { Cost cost = new GenericManaCost(xValue); payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null); } else { payed = true; } } game.informPlayers( new StringBuilder(player.getLogName()) .append(" pays {") .append(xValue) .append("}.") .toString()); return xValue; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { boolean costPaid = false; for (UUID playerId : controller.getInRange()) { Cost cost = new SacrificeTargetCost( new TargetControlledPermanent(new FilterControlledLandPermanent())); Player player = game.getPlayer(playerId); if (player != null && cost.canPay(source, source.getSourceId(), playerId, game) && player.chooseUse(Outcome.Sacrifice, "Sacrifice a land?", game) && cost.pay(source, game, source.getSourceId(), playerId, true)) { costPaid = true; } } if (costPaid) { super.apply(game, source); } return true; } return false; }