/** * 601.2b If a cost that will be paid as the spell is being cast includes * Phyrexian mana symbols, the player announces whether he or she intends to * pay 2 life or the corresponding colored mana cost for each of those * symbols. */ private void handlePhyrexianManaCosts(Game game, UUID sourceId, Player controller) { Iterator<ManaCost> costIterator = manaCostsToPay.iterator(); while (costIterator.hasNext()) { ManaCost cost = costIterator.next(); if (cost instanceof PhyrexianManaCost) { PhyrexianManaCost phyrexianManaCost = (PhyrexianManaCost) cost; PayLifeCost payLifeCost = new PayLifeCost(2); if (payLifeCost.canPay(this, sourceId, controller.getId(), game) && controller.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + '?', this, game)) { costIterator.remove(); costs.add(payLifeCost); } } } }
private void handlePhyrexianManaCosts(UUID payingPlayerId, Ability source, Game game) { Player player = game.getPlayer(payingPlayerId); if (this == null || player == null) { return; // nothing to be done without any mana costs. prevents NRE from occurring here } Iterator<T> manaCostIterator = this.iterator(); Costs<PayLifeCost> tempCosts = new CostsImpl<>(); while (manaCostIterator.hasNext()) { ManaCost manaCost = manaCostIterator.next(); if (manaCost instanceof PhyrexianManaCost) { PhyrexianManaCost phyrexianManaCost = (PhyrexianManaCost) manaCost; PayLifeCost payLifeCost = new PayLifeCost(2); if (payLifeCost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.LoseLife, "Pay 2 life instead of " + phyrexianManaCost.getBaseText() + '?', source, game)) { manaCostIterator.remove(); tempCosts.add(payLifeCost); } } } tempCosts.pay(source, game, source.getSourceId(), player.getId(), false, null); }