protected static int playerPaysXGenericMana(Player player, Ability source, Game game) { int xValue = 0; boolean payed = false; while (!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(player.getLogName() + " pays {" + xValue + '}'); return xValue; }
protected static int playerPaysXGenericMana(Player player, Ability source, Game game) { int xValue = 0; boolean payed = false; while (!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(player.getLogName() + " pays {" + xValue + '}'); return xValue; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if(player != null) { int number = player.announceXMana(0, Integer.MAX_VALUE, "Choose how many times to flip a coin", game, source); game.informPlayers(player.getLogName() + " chooses " + number + '.'); for(int i = 0; i < number; i++) { if(!player.flipCoin(source, game, true)) { return true; } } player.drawCards(2 * number, game); return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int numberChoice = controller.announceXMana(0, Integer.MAX_VALUE, "Choose a number. Noncreature spells with the chosen converted mana cost can't be cast", game, source); game.getState().setValue(source.getSourceId().toString(), numberChoice); Permanent permanent = game.getPermanentEntering(source.getSourceId()); if(permanent != null) { permanent.addInfo("chosen players", "<font color = 'blue'>Chosen Number: " + numberChoice + "</font>", game); game.informPlayers(permanent.getLogName() + ", chosen number: " + numberChoice); } } return true; }
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(player.getLogName() + " pays {" + xValue + "}."); return xValue; }
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(player.getLogName() + " pays {" + xValue + "}."); return xValue; } }
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(player.getLogName() + " pays {" + xValue + "}."); return xValue; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { ManaCosts<ManaCost> cost = new ManaCostsImpl<>("{X}"); int xValue = controller.announceXMana(0, Integer.MAX_VALUE, "Choose the amount of mana to pay", game, source); cost.add(new GenericManaCost(xValue)); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false) && xValue > 0) { new RevealLibraryPutIntoHandEffect(xValue, filter, Zone.LIBRARY, false).apply(game, source); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { int X = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); Cost cost = new GenericManaCost(X); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) { Token token = new SoldierToken(); token.putOntoBattlefield(X, game, source.getSourceId(), source.getControllerId()); return true; } } 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); if (!payed) { game.undo(player.getId()); } } else { payed = true; } } game.informPlayers(player.getLogName() + " pays {" + xValue + "}."); return xValue; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int amount = (Integer) getValue("gainedLife"); if (amount > 0) { int xValue = controller.announceXMana(0, amount, "Announce X Value", game, source); if (xValue > 0) { if (new GenericManaCost(xValue).pay(source, game, source.getSourceId(), controller.getId(), false)) { game.informPlayers(controller.getLogName() + " payed {" + xValue + '}'); controller.drawCards(xValue, game); } else { return false; } } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); ManaCosts<ManaCost> cost = new ManaCostsImpl<>("{X}"); if (you != null && you.chooseUse(Outcome.Neutral, "Do you want to to pay {X}?", source, game)) { int costX = you.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Token token = new GoblinSoldierToken(); return token.putOntoBattlefield(costX, game, source.getSourceId(), source.getControllerId()); } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { ManaCosts cost = new ManaCostsImpl("{X}{W}{U}{U}"); if (controller.chooseUse(Outcome.Damage, "Pay " + cost.getText() + "? If you do, you gain X life and draw X cards.", source, game)) { int costX = controller.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { controller.resetStoredBookmark(game); // otherwise you can undo the payment controller.gainLife(costX, game, source); controller.drawCards(costX, game); return true; } } } return false; }
protected static int playerPaysXGenericMana(Player player, Ability source, Game game) { int xValue = 0; boolean payed = false; while (player.canRespond() && !payed) { int bookmark = game.bookmarkState(); player.resetStoredBookmark(game); 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; } if (!payed) { game.restoreState(bookmark, "Collective Voyage"); game.fireUpdatePlayersEvent(); } else { game.removeBookmark(bookmark); } } game.informPlayers(player.getLogName() + " pays {" + xValue + "}."); return xValue; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); ManaCosts cost = new ManaCostsImpl("{X}"); if (player == null || !player.chooseUse(Outcome.BoostCreature, "Pay " + cost.getText() + "?", source, game)) { return false; } int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); if (!cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return false; } game.addDelayedTriggeredAbility(new IsarethTheAwakenerReflexiveTriggeredAbility(), source); return new SendOptionUsedEventEffect(costX).apply(game, source); } }
@Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); ManaCosts cost = new ManaCostsImpl("{X}"); if (you != null && you.chooseUse(Outcome.BoostCreature, "Do you want to to pay {X}?", source, game)) { int costX = you.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (sourcePermanent != null) { return new AddCountersSourceEffect(CounterType.P1P1.createInstance(costX), true).apply(game, source); } } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.chooseUse(Outcome.BoostCreature, "Do you want to to pay {X}?", source, game)) { int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); Cost cost = new GenericManaCost(costX); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { FilterCard filter = new FilterCard("Equipment card with converted mana cost " + costX + " or less"); filter.add(new SubtypePredicate(SubType.EQUIPMENT)); filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, costX + 1)); new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 1, filter), false, true).apply(game, source); return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (controller != null && targetPlayer != null) { int amountToPay = targetPlayer.announceXMana(0, unpaid.getMana().getGeneric(), "How much mana to pay?", game, source); if (amountToPay > 0) { Cost cost = new GenericManaCost(amountToPay); if (cost.pay(source, game, source.getSourceId(), targetPlayer.getId(), false)) { ManaPool manaPool = controller.getManaPool(); manaPool.addMana(Mana.ColorlessMana(amountToPay), game, source); manaPool.unlockManaType(ManaType.COLORLESS); game.informPlayers(targetPlayer.getLogName() + " paid " + amountToPay + " mana."); game.getState().setValue(source.getSourceId().toString() + game.getState().getZoneChangeCounter(source.getSourceId()), true); } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); ManaCosts cost = new ManaCostsImpl("{X}"); if (player != null) { if (player.chooseUse(Outcome.BoostCreature, "Pay " + cost.getText() + "?", source, game)) { int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null && permanent.isCreature()) { ContinuousEffect effect = new BoostTargetEffect(costX, 0, Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(permanent.getId())); game.addEffect(effect, source); return true; } return false; } } } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); ManaCosts cost = new ManaCostsImpl("{X}{R}"); if (player != null) { if (player.chooseUse(Outcome.Damage, "Pay " + cost.getText() + "? If you do, Flameblast Dragon deals X damage to any target", source, game)) { int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); cost.add(new GenericManaCost(costX)); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { Permanent permanent = game.getPermanent(source.getFirstTarget()); if (permanent != null) { permanent.damage(costX, source.getSourceId(), game, false, true); return true; } Player targetPlayer = game.getPlayer(source.getFirstTarget()); if (targetPlayer != null) { targetPlayer.damage(costX, source.getSourceId(), game, false, true); return true; } return false; } } } return false; }