diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index a725ae13492..33f206094a3 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -319,7 +319,7 @@ public final class GamePanel extends javax.swing.JPanel { private void saveDividerLocations() { // save panel sizes and divider locations. Rectangle rec = MageFrame.getDesktop().getBounds(); - String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight()); + String sb = Double.toString(rec.getWidth()) + 'x' + rec.getHeight(); PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb); PreferencesDialog.saveValue(PreferencesDialog.KEY_GAMEPANEL_DIVIDER_LOCATION_0, Integer.toString(this.jSplitPane0.getDividerLocation())); PreferencesDialog.saveValue(PreferencesDialog.KEY_GAMEPANEL_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation())); @@ -330,7 +330,7 @@ public final class GamePanel extends javax.swing.JPanel { Rectangle rec = MageFrame.getDesktop().getBounds(); if (rec != null) { String size = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, null); - String sb = Double.toString(rec.getWidth()) + 'x' + Double.toString(rec.getHeight()); + String sb = Double.toString(rec.getWidth()) + 'x' + rec.getHeight(); // use divider positions only if screen size is the same as it was the time the settings were saved if (size != null && size.equals(sb)) { @@ -1069,6 +1069,10 @@ public final class GamePanel extends javax.swing.JPanel { needSelectable = new HashSet<>(); } + if (needChoosen.size() == 0 && needSelectable.size() == 0) { + return; + } + // hand if (needZone == Zone.HAND || needZone == Zone.ALL) { for (CardView card : gameView.getHand().values()) { @@ -1081,10 +1085,6 @@ public final class GamePanel extends javax.swing.JPanel { } } - if (needChoosen.size() == 0 && needSelectable.size() == 0) { - return; - } - // stack if (needZone == Zone.STACK || needZone == Zone.ALL) { for (Map.Entry card : gameView.getStack().entrySet()) { diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index 04dabbd016a..8543ca37d4f 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -418,6 +418,7 @@ public class HumanPlayer extends PlayerImpl { @Override public boolean choose(Outcome outcome, Target target, UUID sourceId, Game game, Map options) { + // choose one or multiple permanents updateGameStatePriority("choose(5)", game); UUID abilityControllerId = playerId; if (target.getTargetController() != null @@ -447,6 +448,14 @@ public class HumanPlayer extends PlayerImpl { } waitForResponse(game); if (response.getUUID() != null) { + // selected some target + + // remove selected + if (target.getTargets().contains(response.getUUID())) { + target.remove(response.getUUID()); + continue; + } + if (!targetIds.contains(response.getUUID())) { continue; } @@ -482,13 +491,17 @@ public class HumanPlayer extends PlayerImpl { } } } else { + // send other command like cancel or done (??sends other commands like concede??) + + // auto-complete on all selected if (target.getTargets().size() >= target.getNumberOfTargets()) { return true; } - if (!target.isRequired(sourceId, game)) { + + // cancel/done button + if (!required) { return false; } - } } return false; @@ -496,6 +509,7 @@ public class HumanPlayer extends PlayerImpl { @Override public boolean chooseTarget(Outcome outcome, Target target, Ability source, Game game) { + // choose one or multiple targets updateGameStatePriority("chooseTarget", game); UUID abilityControllerId = playerId; if (target.getAbilityController() != null) { @@ -516,10 +530,13 @@ public class HumanPlayer extends PlayerImpl { } waitForResponse(game); if (response.getUUID() != null) { + + // remove selected if (target.getTargets().contains(response.getUUID())) { target.remove(response.getUUID()); continue; } + if (possibleTargets.contains(response.getUUID())) { if (target.canTarget(abilityControllerId, response.getUUID(), source, game)) { target.addTarget(response.getUUID(), source, game); @@ -554,6 +571,7 @@ public class HumanPlayer extends PlayerImpl { @Override public boolean choose(Outcome outcome, Cards cards, TargetCard target, Game game) { + // choose one or multiple cards if (cards == null) { return false; } @@ -611,6 +629,7 @@ public class HumanPlayer extends PlayerImpl { @Override public boolean chooseTarget(Outcome outcome, Cards cards, TargetCard target, Ability source, Game game) { + // choose one or multiple target cards updateGameStatePriority("chooseTarget(5)", game); while (!abort) { boolean required; @@ -673,6 +692,7 @@ public class HumanPlayer extends PlayerImpl { @Override public boolean chooseTargetAmount(Outcome outcome, TargetAmount target, Ability source, Game game) { + // choose amount updateGameStatePriority("chooseTargetAmount", game); while (!abort) { prepareForResponse(game); @@ -913,6 +933,7 @@ public class HumanPlayer extends PlayerImpl { @Override public TriggeredAbility chooseTriggeredAbility(List abilities, Game game) { + // choose triggered abilitity from list String autoOrderRuleText = null; boolean autoOrderUse = getControllingPlayersUserData(game).isAutoOrderTrigger(); while (!abort) { @@ -989,6 +1010,7 @@ public class HumanPlayer extends PlayerImpl { } protected boolean playManaHandling(Ability abilityToCast, ManaCost unpaid, String promptText, Game game) { + // choose mana to pay (from permanents or from pool) updateGameStatePriority("playMana", game); Map options = new HashMap<>(); prepareForResponse(game); @@ -1649,6 +1671,7 @@ public class HumanPlayer extends PlayerImpl { @Override public Mode chooseMode(Modes modes, Ability source, Game game) { + // choose mode to activate updateGameStatePriority("chooseMode", game); if (modes.size() > 1) { MageObject obj = game.getObject(source.getSourceId());