mirror of
https://github.com/correl/mage.git
synced 2025-03-12 17:00:08 -09:00
* Fixed handling of Phyrexian mana.
This commit is contained in:
parent
0c44857e80
commit
b80e27f3b3
10 changed files with 359 additions and 370 deletions
|
@ -150,12 +150,6 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
this.btnSpecial.setVisible(special);
|
||||
this.btnSpecial.setText("Special");
|
||||
this.helper.setSpecial("Special", special);
|
||||
// Handling Phyrexian mana
|
||||
if (message.contains("P}")) {
|
||||
this.btnSpecial.setVisible(true);
|
||||
this.btnSpecial.setText("Pay 2 life");
|
||||
this.helper.setSpecial("Pay 2 life", true);
|
||||
}
|
||||
}
|
||||
|
||||
requestFocusIfPossible();
|
||||
|
@ -202,7 +196,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
|
||||
// Issue 256: Chat+Feedback panel: request focus prevents players from chatting
|
||||
// Issue #1054: XMage steals window focus whenever the screen updates
|
||||
private void requestFocusIfPossible() {
|
||||
private void requestFocusIfPossible() {
|
||||
boolean requestFocusAllowed = true;
|
||||
if (MageFrame.getInstance().getFocusOwner() == null) {
|
||||
requestFocusAllowed = false;
|
||||
|
|
|
@ -939,9 +939,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
public void ask(String question, GameView gameView, int messageId) {
|
||||
public void ask(String question, GameView gameView, int messageId, Map<String, Serializable> options) {
|
||||
updateGame(gameView);
|
||||
this.feedbackPanel.getFeedback(FeedbackMode.QUESTION, question, false, null, messageId);
|
||||
this.feedbackPanel.getFeedback(FeedbackMode.QUESTION, question, false, options, messageId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1039,10 +1039,10 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
this.feedbackPanel.getFeedback(FeedbackMode.SELECT, messageToDisplay, gameView.getSpecial(), panelOptions, messageId);
|
||||
}
|
||||
|
||||
public void playMana(String message, GameView gameView, int messageId) {
|
||||
public void playMana(String message, GameView gameView, Map<String, Serializable> options, int messageId) {
|
||||
updateGame(gameView);
|
||||
DialogManager.getManager(gameId).fadeOut();
|
||||
this.feedbackPanel.getFeedback(FeedbackMode.CANCEL, message, gameView.getSpecial(), null, messageId);
|
||||
this.feedbackPanel.getFeedback(FeedbackMode.CANCEL, message, gameView.getSpecial(), options, messageId);
|
||||
}
|
||||
|
||||
public void playXMana(String message, GameView gameView, int messageId) {
|
||||
|
|
|
@ -89,25 +89,22 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
try {
|
||||
logger.debug(callback.getMessageId() + " -- " + callback.getMethod());
|
||||
switch (callback.getMethod()) {
|
||||
case "startGame":
|
||||
{
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
GameManager.getInstance().setCurrentPlayerUUID(message.getPlayerId());
|
||||
gameStarted(message.getGameId(), message.getPlayerId());
|
||||
break;
|
||||
}
|
||||
case "startTournament":
|
||||
{
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
tournamentStarted(message.getGameId(), message.getPlayerId());
|
||||
break;
|
||||
}
|
||||
case "startDraft":
|
||||
{
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
draftStarted(message.getGameId(), message.getPlayerId());
|
||||
break;
|
||||
}
|
||||
case "startGame": {
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
GameManager.getInstance().setCurrentPlayerUUID(message.getPlayerId());
|
||||
gameStarted(message.getGameId(), message.getPlayerId());
|
||||
break;
|
||||
}
|
||||
case "startTournament": {
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
tournamentStarted(message.getGameId(), message.getPlayerId());
|
||||
break;
|
||||
}
|
||||
case "startDraft": {
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
draftStarted(message.getGameId(), message.getPlayerId());
|
||||
break;
|
||||
}
|
||||
case "replayGame":
|
||||
replayGame(callback.getObjectId());
|
||||
break;
|
||||
|
@ -117,41 +114,41 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
case "watchGame":
|
||||
watchGame(callback.getObjectId());
|
||||
break;
|
||||
case "chatMessage":
|
||||
{
|
||||
ChatMessage message = (ChatMessage) callback.getData();
|
||||
ChatPanel panel = MageFrame.getChat(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
// play the to the message connected sound
|
||||
if (message.getSoundToPlay() != null) {
|
||||
switch (message.getSoundToPlay()) {
|
||||
case PlayerLeft:
|
||||
AudioManager.playPlayerLeft();
|
||||
break;
|
||||
case PlayerQuitTournament:
|
||||
AudioManager.playPlayerQuitTournament();
|
||||
break;
|
||||
case PlayerSubmittedDeck:
|
||||
AudioManager.playPlayerSubmittedDeck();
|
||||
break;
|
||||
case PlayerWhispered:
|
||||
AudioManager.playPlayerWhispered();
|
||||
break;
|
||||
}
|
||||
case "chatMessage": {
|
||||
ChatMessage message = (ChatMessage) callback.getData();
|
||||
ChatPanel panel = MageFrame.getChat(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
// play the to the message connected sound
|
||||
if (message.getSoundToPlay() != null) {
|
||||
switch (message.getSoundToPlay()) {
|
||||
case PlayerLeft:
|
||||
AudioManager.playPlayerLeft();
|
||||
break;
|
||||
case PlayerQuitTournament:
|
||||
AudioManager.playPlayerQuitTournament();
|
||||
break;
|
||||
case PlayerSubmittedDeck:
|
||||
AudioManager.playPlayerSubmittedDeck();
|
||||
break;
|
||||
case PlayerWhispered:
|
||||
AudioManager.playPlayerWhispered();
|
||||
break;
|
||||
}
|
||||
// send start message to chat if not done yet
|
||||
if (!panel.isStartMessageDone()) {
|
||||
createChatStartMessage(panel);
|
||||
}
|
||||
// send the message to subchat if exists and it's not a game message
|
||||
if (!message.getMessageType().equals(MessageType.GAME) && panel.getConnectedChat() != null) {
|
||||
panel.getConnectedChat().receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), ChatMessage.MessageColor.BLACK);
|
||||
} else {
|
||||
panel.receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), message.getColor());
|
||||
}
|
||||
|
||||
} break;
|
||||
}
|
||||
// send start message to chat if not done yet
|
||||
if (!panel.isStartMessageDone()) {
|
||||
createChatStartMessage(panel);
|
||||
}
|
||||
// send the message to subchat if exists and it's not a game message
|
||||
if (!message.getMessageType().equals(MessageType.GAME) && panel.getConnectedChat() != null) {
|
||||
panel.getConnectedChat().receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), ChatMessage.MessageColor.BLACK);
|
||||
} else {
|
||||
panel.receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), message.getColor());
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "serverMessage":
|
||||
if (callback.getData() != null) {
|
||||
ChatMessage message = (ChatMessage) callback.getData();
|
||||
|
@ -160,134 +157,132 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
} else {
|
||||
JOptionPane.showMessageDialog(null, message.getMessage(), "Server message", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
} break;
|
||||
case "joinedTable":
|
||||
{
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
joinedTable(message.getRoomId(), message.getTableId(), message.getFlag());
|
||||
break;
|
||||
}
|
||||
case "replayInit":
|
||||
{
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.init((GameView) callback.getData());
|
||||
} break;
|
||||
break;
|
||||
case "joinedTable": {
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
joinedTable(message.getRoomId(), message.getTableId(), message.getFlag());
|
||||
break;
|
||||
}
|
||||
case "replayInit": {
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.init((GameView) callback.getData());
|
||||
}
|
||||
case "replayDone":
|
||||
{
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.endMessage((String) callback.getData(), callback.getMessageId());
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
case "replayDone": {
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.endMessage((String) callback.getData(), callback.getMessageId());
|
||||
}
|
||||
case "replayUpdate":
|
||||
{
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.updateGame((GameView) callback.getData());
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
case "replayUpdate": {
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.updateGame((GameView) callback.getData());
|
||||
}
|
||||
case "gameInit":
|
||||
{
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.init((GameView) callback.getData());
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
case "gameInit": {
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.init((GameView) callback.getData());
|
||||
}
|
||||
case "gameOver":
|
||||
{
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.endMessage((String) callback.getData(), callback.getMessageId());
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
case "gameOver": {
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.endMessage((String) callback.getData(), callback.getMessageId());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "gameError":
|
||||
frame.showErrorDialog("Game Error", (String) callback.getData());
|
||||
break;
|
||||
case "gameAsk":
|
||||
{
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.ask(message.getMessage(), message.getGameView(), callback.getMessageId());
|
||||
} break;
|
||||
case "gameAsk": {
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.ask(message.getMessage(), message.getGameView(), callback.getMessageId(), message.getOptions());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "gameTarget": // e.g. Pick triggered ability
|
||||
{
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.pickTarget(message.getMessage(), message.getCardsView(), message.getGameView(),
|
||||
message.getTargets(), message.isFlag(), message.getOptions(), callback.getMessageId());
|
||||
} break;
|
||||
{
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.pickTarget(message.getMessage(), message.getCardsView(), message.getGameView(),
|
||||
message.getTargets(), message.isFlag(), message.getOptions(), callback.getMessageId());
|
||||
}
|
||||
case "gameSelect":
|
||||
{
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.select(message.getMessage(), message.getGameView(), callback.getMessageId(), message.getOptions());
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
case "gameSelect": {
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.select(message.getMessage(), message.getGameView(), callback.getMessageId(), message.getOptions());
|
||||
}
|
||||
case "gameChooseAbility":
|
||||
{
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.pickAbility((AbilityPickerView) callback.getData());
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
case "gameChooseAbility": {
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.pickAbility((AbilityPickerView) callback.getData());
|
||||
}
|
||||
case "gameChoosePile":
|
||||
{
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.pickPile(message.getMessage(), message.getPile1(), message.getPile2());
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
case "gameChoosePile": {
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.pickPile(message.getMessage(), message.getPile1(), message.getPile2());
|
||||
}
|
||||
case "gameChooseChoice":
|
||||
{
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
break;
|
||||
}
|
||||
case "gameChooseChoice": {
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
|
||||
if (panel != null) {
|
||||
panel.getChoice(message.getChoice(), callback.getObjectId());
|
||||
}
|
||||
break;
|
||||
if (panel != null) {
|
||||
panel.getChoice(message.getChoice(), callback.getObjectId());
|
||||
}
|
||||
case "gamePlayMana":
|
||||
{
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.playMana(message.getMessage(), message.getGameView(), callback.getMessageId());
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case "gamePlayMana": {
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.playMana(message.getMessage(), message.getGameView(), message.getOptions(), callback.getMessageId());
|
||||
}
|
||||
case "gamePlayXMana":
|
||||
{
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.playXMana(message.getMessage(), message.getGameView(), callback.getMessageId());
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case "gamePlayXMana": {
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.playXMana(message.getMessage(), message.getGameView(), callback.getMessageId());
|
||||
}
|
||||
case "gameSelectAmount":
|
||||
{
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.getAmount(message.getMin(), message.getMax(), message.getMessage());
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
case "gameSelectAmount": {
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.getAmount(message.getMin(), message.getMax(), message.getMessage());
|
||||
}
|
||||
case "gameUpdate":
|
||||
{
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.updateGame((GameView) callback.getData());
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
case "gameUpdate": {
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.updateGame((GameView) callback.getData());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "endGameInfo":
|
||||
MageFrame.getInstance().showGameEndDialog((GameEndView) callback.getData());
|
||||
break;
|
||||
|
@ -295,7 +290,8 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
List<String> messageData = (List<String>) callback.getData();
|
||||
if (messageData.size() == 2) {
|
||||
JOptionPane.showMessageDialog(null, messageData.get(1), messageData.get(0), JOptionPane.WARNING_MESSAGE);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case "gameInform":
|
||||
if (callback.getMessageId() > gameInformMessageId) {
|
||||
{
|
||||
|
@ -312,72 +308,67 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
}
|
||||
gameInformMessageId = messageId;
|
||||
break;
|
||||
case "gameInformPersonal":
|
||||
{
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
JOptionPane.showMessageDialog(panel, message.getMessage(), "Game message",
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
} break;
|
||||
case "gameInformPersonal": {
|
||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
JOptionPane.showMessageDialog(panel, message.getMessage(), "Game message",
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
case "sideboard":
|
||||
{
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
DeckView deckView = message.getDeck();
|
||||
Deck deck = DeckUtil.construct(deckView);
|
||||
if (message.getFlag()) {
|
||||
construct(deck, message.getTableId(), message.getTime());
|
||||
} else {
|
||||
sideboard(deck, message.getTableId(), message.getTime());
|
||||
} break;
|
||||
}
|
||||
case "construct":
|
||||
{
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
DeckView deckView = message.getDeck();
|
||||
Deck deck = DeckUtil.construct(deckView);
|
||||
break;
|
||||
}
|
||||
case "sideboard": {
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
DeckView deckView = message.getDeck();
|
||||
Deck deck = DeckUtil.construct(deckView);
|
||||
if (message.getFlag()) {
|
||||
construct(deck, message.getTableId(), message.getTime());
|
||||
break;
|
||||
} else {
|
||||
sideboard(deck, message.getTableId(), message.getTime());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "construct": {
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
DeckView deckView = message.getDeck();
|
||||
Deck deck = DeckUtil.construct(deckView);
|
||||
construct(deck, message.getTableId(), message.getTime());
|
||||
break;
|
||||
}
|
||||
case "draftOver":
|
||||
MageFrame.removeDraft(callback.getObjectId());
|
||||
break;
|
||||
case "draftPick":
|
||||
{
|
||||
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
||||
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.loadBooster(message.getDraftPickView());
|
||||
}
|
||||
break;
|
||||
case "draftPick": {
|
||||
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
||||
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.loadBooster(message.getDraftPickView());
|
||||
}
|
||||
case "draftUpdate":
|
||||
{
|
||||
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.updateDraft((DraftView) callback.getData());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "draftInform":
|
||||
// if (callback.getMessageId() > messageId) {
|
||||
{
|
||||
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
||||
break;
|
||||
}
|
||||
case "draftUpdate": {
|
||||
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.updateDraft((DraftView) callback.getData());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "draftInform": // if (callback.getMessageId() > messageId) {
|
||||
{
|
||||
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
||||
}
|
||||
// } else {
|
||||
// logger.warn("message out of sequence - ignoring");
|
||||
// }
|
||||
break;
|
||||
case "draftInit":
|
||||
{
|
||||
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
||||
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.loadBooster(message.getDraftPickView());
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case "draftInit": {
|
||||
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
||||
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
panel.loadBooster(message.getDraftPickView());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "tournamentInit":
|
||||
break;
|
||||
case "userRequestDialog":
|
||||
|
@ -413,7 +404,7 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
break;
|
||||
case TOURNAMENT:
|
||||
usedPanel.receiveMessage("", new StringBuilder("On this panel you can see the players, their state and the results of the games of the tournament. Also you can chat with the competitors of the tournament.").toString(),
|
||||
null, MessageType.USER_INFO, ChatMessage.MessageColor.BLUE);
|
||||
null, MessageType.USER_INFO, ChatMessage.MessageColor.BLUE);
|
||||
break;
|
||||
case TABLES:
|
||||
usedPanel.receiveMessage("", new StringBuilder("Download card images by using the \"Images\" menu to the top right .")
|
||||
|
|
|
@ -683,7 +683,11 @@ public class HumanPlayer extends PlayerImpl {
|
|||
|
||||
protected boolean playManaHandling(ManaCost unpaid, String promptText, Game game) {
|
||||
updateGameStatePriority("playMana", game);
|
||||
game.firePlayManaEvent(playerId, "Pay " + promptText);
|
||||
Map<String, Serializable> options = new HashMap<>();
|
||||
if (unpaid.getText().contains("P}")) {
|
||||
options.put(Constants.Option.SPECIAL_BUTTON, (Serializable) "Pay 2 life");
|
||||
}
|
||||
game.firePlayManaEvent(playerId, "Pay " + promptText, options);
|
||||
waitForResponse(game);
|
||||
if (!this.isInGame()) {
|
||||
return false;
|
||||
|
|
|
@ -240,7 +240,7 @@ public class GameController implements GameCallback {
|
|||
select(event.getPlayerId(), event.getMessage(), event.getOptions());
|
||||
break;
|
||||
case PLAY_MANA:
|
||||
playMana(event.getPlayerId(), event.getMessage());
|
||||
playMana(event.getPlayerId(), event.getMessage(), event.getOptions());
|
||||
break;
|
||||
case PLAY_X_MANA:
|
||||
playXMana(event.getPlayerId(), event.getMessage());
|
||||
|
@ -850,11 +850,11 @@ public class GameController implements GameCallback {
|
|||
});
|
||||
}
|
||||
|
||||
private synchronized void playMana(UUID playerId, final String message) throws MageException {
|
||||
private synchronized void playMana(UUID playerId, final String message, final Map<String, Serializable> options) throws MageException {
|
||||
perform(playerId, new Command() {
|
||||
@Override
|
||||
public void execute(UUID playerId) {
|
||||
getGameSession(playerId).playMana(message);
|
||||
getGameSession(playerId).playMana(message, options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1026,7 +1026,7 @@ public class GameController implements GameCallback {
|
|||
// player has game under control (is not cotrolled by other player)
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null && player.isGameUnderControl()) {
|
||||
// if it's your priority (or game not started yet in which case it will be null)
|
||||
// if it's your priority (or game not started yet in which case it will be null)
|
||||
// then execute only your action
|
||||
if (game.getPriorityPlayerId() == null || game.getPriorityPlayerId().equals(playerId)) {
|
||||
if (gameSessions.containsKey(playerId)) {
|
||||
|
@ -1041,7 +1041,7 @@ public class GameController implements GameCallback {
|
|||
command.execute(controlled);
|
||||
}
|
||||
}
|
||||
// else player has no priority to do something, so ignore the command
|
||||
// else player has no priority to do something, so ignore the command
|
||||
// e.g. you click at one of your cards, but you can't play something at that moment
|
||||
}
|
||||
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.server.game;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -45,7 +44,6 @@ import mage.game.Game;
|
|||
import mage.game.Table;
|
||||
import mage.interfaces.callback.ClientCallback;
|
||||
import mage.players.Player;
|
||||
import mage.players.net.UserData;
|
||||
import mage.server.User;
|
||||
import mage.server.UserManager;
|
||||
import mage.server.util.ThreadExecutor;
|
||||
|
@ -80,7 +78,7 @@ public class GameSessionPlayer extends GameSessionWatcher {
|
|||
super.CleanUp();
|
||||
}
|
||||
|
||||
public void ask(final String question) {
|
||||
public void ask(final String question) {
|
||||
if (!killed) {
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user != null) {
|
||||
|
@ -134,11 +132,11 @@ public class GameSessionPlayer extends GameSessionWatcher {
|
|||
}
|
||||
}
|
||||
|
||||
public void playMana(final String message) {
|
||||
public void playMana(final String message, final Map<String, Serializable> options) {
|
||||
if (!killed) {
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user != null) {
|
||||
user.fireCallback(new ClientCallback("gamePlayMana", game.getId(), new GameClientMessage(getGameView(), message)));
|
||||
user.fireCallback(new ClientCallback("gamePlayMana", game.getId(), new GameClientMessage(getGameView(), message, options)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -176,19 +174,18 @@ public class GameSessionPlayer extends GameSessionWatcher {
|
|||
User requestedUser = UserManager.getInstance().getUser(userId);
|
||||
if (requestedUser != null && requestingUser != null) {
|
||||
String message;
|
||||
switch(numberTurns) {
|
||||
case 0:
|
||||
switch (numberTurns) {
|
||||
case 0:
|
||||
message = "Allow rollback to the start of the current turn?";
|
||||
break;
|
||||
case 1:
|
||||
message = "Allow rollback to the start of the previous turn?";
|
||||
break;
|
||||
default:
|
||||
message = "Allow to rollback "+numberTurns+ " turns?";
|
||||
message = "Allow to rollback " + numberTurns + " turns?";
|
||||
}
|
||||
UserRequestMessage userRequestMessage = new UserRequestMessage(
|
||||
"Request by " + requestedUser.getName(), message
|
||||
, PlayerAction.REQUEST_PERMISSION_TO_ROLLBACK_TURN);
|
||||
"Request by " + requestedUser.getName(), message, PlayerAction.REQUEST_PERMISSION_TO_ROLLBACK_TURN);
|
||||
userRequestMessage.setRelatedUser(requestingUserId, requestingUser.getName());
|
||||
userRequestMessage.setGameId(game.getId());
|
||||
userRequestMessage.setButton1("Accept", PlayerAction.ADD_PERMISSION_TO_ROLLBACK_TURN);
|
||||
|
@ -197,7 +194,7 @@ public class GameSessionPlayer extends GameSessionWatcher {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void requestPermissionToSeeHandCards(UUID watcherId) {
|
||||
if (!killed) {
|
||||
User watcher = UserManager.getInstance().getUser(watcherId);
|
||||
|
@ -205,9 +202,8 @@ public class GameSessionPlayer extends GameSessionWatcher {
|
|||
if (user != null && watcher != null) {
|
||||
UserRequestMessage userRequestMessage = new UserRequestMessage(
|
||||
"User request",
|
||||
"Allow user <b>" + watcher.getName() + "</b> for this match to see your hand cards?<br>" +
|
||||
"(You can revoke this every time using related popup menu item of your battlefield.)"
|
||||
, PlayerAction.REQUEST_PERMISSION_TO_SEE_HAND_CARDS);
|
||||
"Allow user <b>" + watcher.getName() + "</b> for this match to see your hand cards?<br>"
|
||||
+ "(You can revoke this every time using related popup menu item of your battlefield.)", PlayerAction.REQUEST_PERMISSION_TO_SEE_HAND_CARDS);
|
||||
userRequestMessage.setRelatedUser(watcherId, watcher.getName());
|
||||
userRequestMessage.setGameId(game.getId());
|
||||
userRequestMessage.setButton1("Accept", PlayerAction.ADD_PERMISSION_TO_SEE_HAND_CARDS);
|
||||
|
@ -286,39 +282,39 @@ public class GameSessionPlayer extends GameSessionWatcher {
|
|||
final Player player = game.getPlayer(playerId);
|
||||
if (player != null && player.isInGame()) {
|
||||
callExecutor.execute(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (game.getStartTime() == null) {
|
||||
// gameController is still waiting to start the game
|
||||
player.leave();
|
||||
} else {
|
||||
// game was already started
|
||||
player.quit(game);
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
if (ex != null) {
|
||||
// It seems this can happen if two threads try to end the game at the exact same time (one wins and one ends here)
|
||||
logger.fatal("Game session game quit exception " + (ex.getMessage() == null ? "null":ex.getMessage()));
|
||||
logger.debug("- gameId:" + game.getId() +" playerId: " + playerId);
|
||||
if (ex.getCause() != null) {
|
||||
logger.debug("- Cause: " + (ex.getCause().getMessage() == null ? "null":ex.getCause().getMessage()), ex);
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (game.getStartTime() == null) {
|
||||
// gameController is still waiting to start the game
|
||||
player.leave();
|
||||
} else {
|
||||
logger.debug("- ex: " + ex.toString(), ex);
|
||||
// game was already started
|
||||
player.quit(game);
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
if (ex != null) {
|
||||
// It seems this can happen if two threads try to end the game at the exact same time (one wins and one ends here)
|
||||
logger.fatal("Game session game quit exception " + (ex.getMessage() == null ? "null" : ex.getMessage()));
|
||||
logger.debug("- gameId:" + game.getId() + " playerId: " + playerId);
|
||||
if (ex.getCause() != null) {
|
||||
logger.debug("- Cause: " + (ex.getCause().getMessage() == null ? "null" : ex.getCause().getMessage()), ex);
|
||||
} else {
|
||||
logger.debug("- ex: " + ex.toString(), ex);
|
||||
}
|
||||
} else {
|
||||
logger.fatal("Game session game quit exception - null gameId:" + game.getId() + " playerId: " + playerId);
|
||||
}
|
||||
}else {
|
||||
logger.fatal("Game session game quit exception - null gameId:" + game.getId() +" playerId: " + playerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
logger.error("game object missing playerId: " + (playerId == null ? "[null]":playerId));
|
||||
logger.error("game object missing playerId: " + (playerId == null ? "[null]" : playerId));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ public interface Game extends MageItem, Serializable {
|
|||
|
||||
void firePriorityEvent(UUID playerId);
|
||||
|
||||
void firePlayManaEvent(UUID playerId, String message);
|
||||
void firePlayManaEvent(UUID playerId, String message, Map<String, Serializable> options);
|
||||
|
||||
void firePlayXManaEvent(UUID playerId, String message);
|
||||
|
||||
|
@ -322,7 +322,6 @@ public interface Game extends MageItem, Serializable {
|
|||
void endMulligan(UUID playerId);
|
||||
|
||||
// void quit(UUID playerId);
|
||||
|
||||
void timerTimeout(UUID playerId);
|
||||
|
||||
void idleTimeout(UUID playerId);
|
||||
|
|
|
@ -1868,11 +1868,11 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void firePlayManaEvent(UUID playerId, String message) {
|
||||
public void firePlayManaEvent(UUID playerId, String message, Map<String, Serializable> options) {
|
||||
if (simulation) {
|
||||
return;
|
||||
}
|
||||
playerQueryEventSource.playMana(playerId, message);
|
||||
playerQueryEventSource.playMana(playerId, message, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,43 +1,46 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.game.events;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.EventObject;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import mage.choices.Choice;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -46,6 +49,7 @@ import mage.choices.Choice;
|
|||
public class PlayerQueryEvent extends EventObject implements ExternalEvent, Serializable {
|
||||
|
||||
public enum QueryType {
|
||||
|
||||
ASK, CHOOSE_CHOICE, CHOOSE_ABILITY, CHOOSE_MODE, PICK_TARGET, PICK_ABILITY, SELECT, PLAY_MANA, PLAY_X_MANA, AMOUNT, PICK_CARD, CONSTRUCT, CHOOSE_PILE, PERSONAL_MESSAGE
|
||||
}
|
||||
|
||||
|
@ -67,7 +71,6 @@ public class PlayerQueryEvent extends EventObject implements ExternalEvent, Seri
|
|||
private List<? extends Card> pile2;
|
||||
private Choice choice;
|
||||
|
||||
|
||||
private PlayerQueryEvent(UUID playerId, String message, List<? extends Ability> abilities, Set<String> choices, Set<UUID> targets, Cards cards, QueryType queryType, int min, int max, boolean required, Map<String, Serializable> options) {
|
||||
this(playerId, message, abilities, choices, targets, cards, queryType, min, max, required);
|
||||
this.options = options;
|
||||
|
@ -197,15 +200,15 @@ public class PlayerQueryEvent extends EventObject implements ExternalEvent, Seri
|
|||
return new PlayerQueryEvent(playerId, message, null, null, null, null, QueryType.SELECT, 0, 0, false, options);
|
||||
}
|
||||
|
||||
public static PlayerQueryEvent playManaEvent(UUID playerId, String message) {
|
||||
return new PlayerQueryEvent(playerId, message, null, null, null, null, QueryType.PLAY_MANA, 0, 0, false);
|
||||
public static PlayerQueryEvent playManaEvent(UUID playerId, String message, Map<String, Serializable> options) {
|
||||
return new PlayerQueryEvent(playerId, message, null, null, null, null, QueryType.PLAY_MANA, 0, 0, false, options);
|
||||
}
|
||||
|
||||
public static PlayerQueryEvent playXManaEvent(UUID playerId, String message) {
|
||||
return new PlayerQueryEvent(playerId, message, null, null, null, null, QueryType.PLAY_X_MANA, 0, 0, false);
|
||||
}
|
||||
|
||||
public static PlayerQueryEvent amountEvent(UUID playerId, String message, int min , int max) {
|
||||
public static PlayerQueryEvent amountEvent(UUID playerId, String message, int min, int max) {
|
||||
return new PlayerQueryEvent(playerId, message, null, null, null, null, QueryType.AMOUNT, min, max, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,42 +1,43 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.game.events;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import mage.choices.Choice;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -44,7 +45,8 @@ import mage.choices.Choice;
|
|||
*/
|
||||
public class PlayerQueryEventSource implements EventSource<PlayerQueryEvent>, Serializable {
|
||||
|
||||
protected final EventDispatcher<PlayerQueryEvent> dispatcher = new EventDispatcher<PlayerQueryEvent>() {};
|
||||
protected final EventDispatcher<PlayerQueryEvent> dispatcher = new EventDispatcher<PlayerQueryEvent>() {
|
||||
};
|
||||
|
||||
@Override
|
||||
public void addListener(Listener<PlayerQueryEvent> listener) {
|
||||
|
@ -100,8 +102,8 @@ public class PlayerQueryEventSource implements EventSource<PlayerQueryEvent>, Se
|
|||
dispatcher.fireEvent(PlayerQueryEvent.targetEvent(playerId, message, perms, required));
|
||||
}
|
||||
|
||||
public void playMana(UUID playerId, String message) {
|
||||
dispatcher.fireEvent(PlayerQueryEvent.playManaEvent(playerId, message));
|
||||
public void playMana(UUID playerId, String message, Map<String, Serializable> options) {
|
||||
dispatcher.fireEvent(PlayerQueryEvent.playManaEvent(playerId, message, options));
|
||||
}
|
||||
|
||||
public void amount(UUID playerId, String message, int min, int max) {
|
||||
|
|
Loading…
Add table
Reference in a new issue