@Override public boolean apply(Game game, Ability source) { ManaCostsImpl cost = new ManaCostsImpl("{X}"); cost.clearPaid(); if (cost.payOrRollback(source, game, source.getSourceId(), source.getControllerId())) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.gainLife(cost.getX(), game, source); return true; } } return false; }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player player = game.getPlayer(event.getPlayerId()); if (player != null) { int amount = xCosts.calculate(game, source, this); if (amount > 0) { String mana = "{" + amount + '}'; ManaCostsImpl cost = new ManaCostsImpl(mana); if (cost.canPay(source, source.getSourceId(), event.getPlayerId(), game) && player.chooseUse(Outcome.Benefit, "Pay " + mana + " to declare blocker?", source, game)) { if (cost.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) { return false; } } return true; } } return false; }
cost.add(new GenericManaCost(payAmount)); cost.clearPaid(); if (cost.payOrRollback(source, game, source.getSourceId(), playerId)) { paid = true;
if (totalCost.payOrRollback(source, game, source.getSourceId(), source.getControllerId())) { game.fireEvent(new ManaEvent(EventType.PAID_CUMULATIVE_UPKEEP, permanent.getId(), permanent.getId(), player.getId(), totalCost.getUsedManaToPay())); return true;