mirror of
https://github.com/correl/mage.git
synced 2025-04-11 17:00:08 -09:00
Fixed #180 : Paying additional cost of Mana Leak or Spell Rupture isn't handled correct
This commit is contained in:
parent
5f17804e93
commit
143f0f76e7
3 changed files with 13 additions and 17 deletions
Mage.Client/src/main/java/mage/client/game
Mage.Common/src/mage/view
|
@ -491,12 +491,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
CombatManager.getInstance().hideCombat(gameId);
|
||||
}
|
||||
|
||||
System.out.println("Size: " + game.getStatesSavedSize());
|
||||
if (game.getStatesSavedSize() > 0) {
|
||||
feedbackPanel.allowUndo(game.getStatesSavedSize());
|
||||
} else {
|
||||
feedbackPanel.disableUndo();
|
||||
}
|
||||
feedbackPanel.disableUndo();
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
|
@ -608,6 +603,11 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
options.put("your_turn", true);
|
||||
messageToDisplay = message + " <div style='font-size:11pt'>Your turn</div>";
|
||||
}
|
||||
// magenoxx: because of uncaught bug with saving state, rolling back and stack
|
||||
// undo is allowed only for empty stack
|
||||
if (playerView.getStatesSavedSize() > 0 && gameView.getStack().size() == 0) {
|
||||
feedbackPanel.allowUndo(playerView.getStatesSavedSize());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,17 +74,10 @@ public class GameView implements Serializable {
|
|||
private String priorityPlayerName = "";
|
||||
private int turn;
|
||||
private boolean special = false;
|
||||
private int statesSavedSize;
|
||||
|
||||
public GameView(GameState state, Game game) {
|
||||
for (Player player: state.getPlayers().values()) {
|
||||
players.add(new PlayerView(player, state, game));
|
||||
if (player.getStoredBookmark() > 0) {
|
||||
if (this.statesSavedSize > 0) {
|
||||
throw new IllegalStateException("This shouldn't happen");
|
||||
}
|
||||
this.statesSavedSize = player.getStoredBookmark();
|
||||
}
|
||||
}
|
||||
for (StackObject stackObject: state.getStack()) {
|
||||
if (stackObject instanceof StackAbility) {
|
||||
|
@ -260,8 +253,4 @@ public class GameView implements Serializable {
|
|||
public boolean getSpecial() {
|
||||
return special;
|
||||
}
|
||||
|
||||
public int getStatesSavedSize() {
|
||||
return statesSavedSize;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ public class PlayerView implements Serializable {
|
|||
private UserDataView userDataView;
|
||||
private List<EmblemView> emblemList = new ArrayList<EmblemView>();
|
||||
private List<UUID> attachments = new ArrayList<UUID>();
|
||||
private int statesSavedSize;
|
||||
|
||||
public PlayerView(Player player, GameState state, Game game) {
|
||||
this.playerId = player.getId();
|
||||
|
@ -105,6 +106,8 @@ public class PlayerView implements Serializable {
|
|||
if (player.getAttachments() != null) {
|
||||
attachments.addAll(player.getAttachments());
|
||||
}
|
||||
|
||||
this.statesSavedSize = player.getStoredBookmark();
|
||||
}
|
||||
|
||||
private boolean showInBattlefield(Permanent permanent, GameState state) {
|
||||
|
@ -184,4 +187,8 @@ public class PlayerView implements Serializable {
|
|||
public boolean hasAttachments() {
|
||||
return attachments != null && attachments.size() > 0;
|
||||
}
|
||||
|
||||
public int getStatesSavedSize() {
|
||||
return statesSavedSize;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue