mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Collective Voyage - Undo mana payment if mana payment is canceled (fixes #3850).
This commit is contained in:
parent
4aca2506d8
commit
de62867a5d
1 changed files with 13 additions and 8 deletions
|
@ -27,6 +27,8 @@
|
|||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
|
@ -42,9 +44,6 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
@ -54,7 +53,6 @@ public class CollectiveVoyage extends CardImpl {
|
|||
public CollectiveVoyage(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}");
|
||||
|
||||
|
||||
// Join forces - Starting with you, each player may pay any amount of mana. Each player searches his or her library for up to X basic land cards, where X is the total amount of mana paid this way, puts them onto the battlefield tapped, then shuffles his or her library.
|
||||
this.getSpellAbility().addEffect(new CollectiveVoyageEffect());
|
||||
}
|
||||
|
@ -128,6 +126,8 @@ class CollectiveVoyageEffect extends OneShotEffect {
|
|||
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);
|
||||
|
@ -135,9 +135,14 @@ class CollectiveVoyageEffect extends OneShotEffect {
|
|||
} else {
|
||||
payed = true;
|
||||
}
|
||||
if (!payed) {
|
||||
game.restoreState(bookmark, "Collective Voyage");
|
||||
game.fireUpdatePlayersEvent();
|
||||
} else {
|
||||
game.removeBookmark(bookmark);
|
||||
}
|
||||
}
|
||||
game.informPlayers(new StringBuilder(player.getLogName()).append(" pays {").append(xValue).append("}.").toString());
|
||||
return xValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue