mirror of
https://github.com/correl/mage.git
synced 2024-11-28 11:09:54 +00:00
* Deactivated macro button, becuase it's not working correctly (#2147).
This commit is contained in:
parent
94994dd3ec
commit
400bbba8e1
3 changed files with 92 additions and 76 deletions
|
@ -305,7 +305,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
this.players.clear();
|
this.players.clear();
|
||||||
this.playersWhoLeft.clear();
|
this.playersWhoLeft.clear();
|
||||||
|
|
||||||
if (jLayeredPane!= null) {
|
if (jLayeredPane != null) {
|
||||||
jLayeredPane.remove(abilityPicker);
|
jLayeredPane.remove(abilityPicker);
|
||||||
jLayeredPane.remove(DialogManager.getManager(gameId));
|
jLayeredPane.remove(DialogManager.getManager(gameId));
|
||||||
}
|
}
|
||||||
|
@ -1440,7 +1440,6 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
int c = JComponent.WHEN_IN_FOCUSED_WINDOW;
|
int c = JComponent.WHEN_IN_FOCUSED_WINDOW;
|
||||||
|
|
||||||
|
|
||||||
btnToggleMacro.setContentAreaFilled(false);
|
btnToggleMacro.setContentAreaFilled(false);
|
||||||
btnToggleMacro.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
|
btnToggleMacro.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
|
||||||
btnToggleMacro.setIcon(new ImageIcon(ImageManagerImpl.instance.getToggleRecordMacroButtonImage()));
|
btnToggleMacro.setIcon(new ImageIcon(ImageManagerImpl.instance.getToggleRecordMacroButtonImage()));
|
||||||
|
@ -1837,9 +1836,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
.addComponent(btnSkipToEndStepBeforeYourTurn)
|
.addComponent(btnSkipToEndStepBeforeYourTurn)
|
||||||
)
|
)
|
||||||
.addGroup(gl_pnlShortCuts.createSequentialGroup()
|
.addGroup(gl_pnlShortCuts.createSequentialGroup()
|
||||||
.addComponent(btnToggleMacro)
|
|
||||||
.addComponent(txtHoldPriority)
|
.addComponent(txtHoldPriority)
|
||||||
.addComponent(txtSpellsCast)
|
.addComponent(txtSpellsCast)
|
||||||
|
/* .addComponent(btnToggleMacro)*/
|
||||||
.addComponent(btnSwitchHands)
|
.addComponent(btnSwitchHands)
|
||||||
.addComponent(btnCancelSkip)
|
.addComponent(btnCancelSkip)
|
||||||
.addComponent(btnConcede)
|
.addComponent(btnConcede)
|
||||||
|
|
|
@ -87,7 +87,6 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
protected static FilterAttackingCreature filterAttack = new FilterAttackingCreature();
|
protected static FilterAttackingCreature filterAttack = new FilterAttackingCreature();
|
||||||
protected static FilterBlockingCreature filterBlock = new FilterBlockingCreature();
|
protected static FilterBlockingCreature filterBlock = new FilterBlockingCreature();
|
||||||
protected final Choice replacementEffectChoice;
|
protected final Choice replacementEffectChoice;
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(HumanPlayer.class);
|
private static final Logger logger = Logger.getLogger(HumanPlayer.class);
|
||||||
|
|
||||||
protected HashSet<String> autoSelectReplacementEffects = new HashSet<>();
|
protected HashSet<String> autoSelectReplacementEffects = new HashSet<>();
|
||||||
|
@ -119,9 +118,26 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
|
|
||||||
public HumanPlayer(final HumanPlayer player) {
|
public HumanPlayer(final HumanPlayer player) {
|
||||||
super(player);
|
super(player);
|
||||||
|
this.replacementEffectChoice = player.replacementEffectChoice;
|
||||||
this.autoSelectReplacementEffects.addAll(autoSelectReplacementEffects);
|
this.autoSelectReplacementEffects.addAll(autoSelectReplacementEffects);
|
||||||
this.currentlyUnpaidMana = player.currentlyUnpaidMana;
|
this.currentlyUnpaidMana = player.currentlyUnpaidMana;
|
||||||
this.replacementEffectChoice = player.replacementEffectChoice;
|
|
||||||
|
this.triggerAutoOrderAbilityFirst.addAll(player.triggerAutoOrderAbilityFirst);
|
||||||
|
this.triggerAutoOrderAbilityLast.addAll(player.triggerAutoOrderAbilityLast);
|
||||||
|
this.triggerAutoOrderNameFirst.addAll(player.triggerAutoOrderNameFirst);
|
||||||
|
this.triggerAutoOrderNameLast.addAll(player.triggerAutoOrderNameLast);
|
||||||
|
|
||||||
|
this.requestAutoAnswerId.putAll(player.requestAutoAnswerId);
|
||||||
|
this.requestAutoAnswerText.putAll(player.requestAutoAnswerText);
|
||||||
|
|
||||||
|
this.holdingPriority = player.holdingPriority;
|
||||||
|
|
||||||
|
this.actionQueue.addAll(player.actionQueue);
|
||||||
|
this.actionQueueSaved.addAll(player.actionQueueSaved);
|
||||||
|
this.actionIterations = player.actionIterations;
|
||||||
|
this.recordingMacro = player.recordingMacro;
|
||||||
|
this.macroTriggeredSelectionFlag = player.macroTriggeredSelectionFlag;
|
||||||
|
this.activatingMacro = player.activatingMacro;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isExecutingMacro() {
|
protected boolean isExecutingMacro() {
|
||||||
|
@ -134,6 +150,7 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (actionQueue.isEmpty() && actionIterations > 0 && !actionQueueSaved.isEmpty()) {
|
if (actionQueue.isEmpty() && actionIterations > 0 && !actionQueueSaved.isEmpty()) {
|
||||||
actionQueue = new LinkedList(actionQueueSaved);
|
actionQueue = new LinkedList(actionQueueSaved);
|
||||||
actionIterations--;
|
actionIterations--;
|
||||||
|
// logger.info("MACRO iteration: " + actionIterations);
|
||||||
}
|
}
|
||||||
PlayerResponse action = actionQueue.poll();
|
PlayerResponse action = actionQueue.poll();
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
|
@ -158,6 +175,11 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
protected void waitForResponse(Game game) {
|
protected void waitForResponse(Game game) {
|
||||||
if (isExecutingMacro()) {
|
if (isExecutingMacro()) {
|
||||||
pullResponseFromQueue(game);
|
pullResponseFromQueue(game);
|
||||||
|
// logger.info("MACRO pull from queue: " + response.toString());
|
||||||
|
// try {
|
||||||
|
// TimeUnit.MILLISECONDS.sleep(1000);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// }
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
response.clear();
|
response.clear();
|
||||||
|
@ -166,7 +188,7 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
synchronized (response) {
|
synchronized (response) {
|
||||||
try {
|
try {
|
||||||
response.wait();
|
response.wait();
|
||||||
logger.debug("Got response from player: " + getId());
|
logger.info("Got response from player: " + response.toString());
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
logger.error("Response error for player " + getName() + " gameId: " + game.getId(), ex);
|
logger.error("Response error for player " + getName() + " gameId: " + game.getId(), ex);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -174,7 +196,7 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (recordingMacro && !macroTriggeredSelectionFlag) {
|
if (recordingMacro && !macroTriggeredSelectionFlag) {
|
||||||
logger.debug("Adding an action " + response);
|
// logger.info("Adding an action " + response);
|
||||||
actionQueueSaved.add(new PlayerResponse(response));
|
actionQueueSaved.add(new PlayerResponse(response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,7 @@
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.player.human;
|
package mage.player.human;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -49,18 +48,14 @@ public class PlayerResponse implements Serializable {
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new StringBuilder((responseString == null) ? "null" : responseString)
|
return ((responseString == null) ? "null" : responseString)
|
||||||
.append(',')
|
+ ',' + responseUUID
|
||||||
.append(responseUUID)
|
+ ',' + responseBoolean
|
||||||
.append(',')
|
+ ',' + responseInteger
|
||||||
.append(responseBoolean)
|
+ ',' + responseManaType
|
||||||
.append(',')
|
+ ',' + responseManaTypePlayerId;
|
||||||
.append(responseInteger)
|
|
||||||
.append(',')
|
|
||||||
.append(responseManaType)
|
|
||||||
.append(',')
|
|
||||||
.append(responseManaTypePlayerId).toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerResponse(PlayerResponse other) {
|
public PlayerResponse(PlayerResponse other) {
|
||||||
|
|
Loading…
Reference in a new issue