@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { StringBuilder sb = new StringBuilder(cost.getText()).append('?'); if (!sb.toString().toLowerCase(Locale.ENGLISH).startsWith("exile ") && !sb.toString().toLowerCase(Locale.ENGLISH).startsWith("return ")) { sb.insert(0, "Pay "); } String message = CardUtil.replaceSourceName(sb.toString(), sourcePermanent.getLogName()); message = Character.toUpperCase(message.charAt(0)) + message.substring(1); if (controller.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } controller.moveCardsToExile(sourcePermanent, source, game, true, null, ""); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { StringBuilder sb = new StringBuilder(cost.getText()).append('?'); if (!sb.toString().toLowerCase(Locale.ENGLISH).startsWith("exile ") && !sb.toString().toLowerCase(Locale.ENGLISH).startsWith("return ")) { sb.insert(0, "Pay "); } String message = CardUtil.replaceSourceName(sb.toString(), sourcePermanent.getLogName()); message = Character.toUpperCase(message.charAt(0)) + message.substring(1); if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) && controller.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { game.informPlayers(controller.getLogName() + " pays " + cost.getText()); return true; } } if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()) && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) { sourcePermanent.sacrifice(source.getSourceId(), game); } return true; } return false; }
CardUtil.replaceSourceName(message, mageObject.getName()); } else { message = chooseUseText; message = CardUtil.replaceSourceName(message, mageObject.getLogName()); boolean result = true; if (cost.canPay(source, source.getSourceId(), player.getId(), game)
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (player != null && permanent != null) { String message = CardUtil.replaceSourceName("Pay {this}'s mana cost?", permanent.getLogName()); Cost cost = permanent.getManaCost().copy(); if (player.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } permanent.sacrifice(source.getSourceId(), game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (player != null && permanent != null) { String message = CardUtil.replaceSourceName("Pay {this} mana cost ?", permanent.getLogName()); Cost cost = permanent.getManaCost().copy(); if (player.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } permanent.sacrifice(source.getSourceId(), game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (player != null && permanent != null) { String message = CardUtil.replaceSourceName("Pay {this} mana cost ?", permanent.getLogName()); Cost cost = permanent.getManaCost().copy(); if (player.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } permanent.sacrifice(source.getSourceId(), game); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { String message = "sacrifice a land?"; message = CardUtil.replaceSourceName(message, sourcePermanent.getLogName()); message = Character.toUpperCase(message.charAt(0)) + message.substring(1); if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) && controller.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()) && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) { ContinuousEffect effect = new GiveControlEffect(); effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); game.addEffect(effect, source); game.informPlayers(game.getPlayer(source.getFirstTarget()).getLogName() + " gains control of " + sourcePermanent.getIdName()); } return true; } return false; }
message = chooseUseText; message = CardUtil.replaceSourceName(message, sourceObject.getName()); boolean result = true; boolean doEffect = true;
message = chooseUseText; message = CardUtil.replaceSourceName(message, sourceObject.getName()); boolean result = true; boolean doEffect = true;
if (chooseUseText != null) { message = chooseUseText; message = CardUtil.replaceSourceName(message, mageObject.getLogName());
message = chooseUseText; message = CardUtil.replaceSourceName(message, sourceObject.getName()); boolean result = true; boolean doEffect = true;
@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 controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { String message = CardUtil.replaceSourceName(chooseUseText, sourceObject.getName()); boolean result = true; boolean doEffect = true; // check if any player is willing to pay for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null && cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { if (!game.isSimulation()) { game.informPlayers(player.getLogName() + " pays the cost to prevent the effect"); } doEffect = false; } } } // do the effects if nobody paid if (doEffect) { return manaEffect.apply(game, source); } return result; } return false; }
message = chooseUseText; message = CardUtil.replaceSourceName(message, sourceObject.getName()); boolean result = true; boolean doEffect = true;