Triggered actions per player should be immutable.

This commit is contained in:
marcins78@gmail.com
2011-09-20 11:56:19 +00:00
parent c341e74631
commit 152c414200
2 changed files with 48 additions and 48 deletions

View File

@@ -11,10 +11,7 @@ import com.gempukku.lotro.logic.timing.actions.SystemAction;
import com.gempukku.lotro.logic.timing.processes.GameProcess;
import com.gempukku.lotro.logic.timing.processes.pregame.BiddingGameProcess;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
// Action generates multiple Effects, both costs and result of an action are Effects.
@@ -162,7 +159,7 @@ public class TurnProcedure {
public void doPlayEffect(LotroGame game) {
if (!_effect.isCancelled()) {
final String activePlayer = _playOrder.getNextPlayer();
List<Action> possibleActions = _actionMap.get(activePlayer);
List<Action> possibleActions = new LinkedList<Action>(_actionMap.get(activePlayer));
possibleActions.addAll(_game.getActionsEnvironment().getOptionalBeforeActions(activePlayer, _effect));
if (possibleActions.size() > 0) {
@@ -211,7 +208,7 @@ public class TurnProcedure {
@Override
public void doPlayEffect(LotroGame game) {
final String activePlayer = _playOrder.getNextPlayer();
List<Action> possibleActions = _actionMap.get(activePlayer);
List<Action> possibleActions = new LinkedList<Action>(_actionMap.get(activePlayer));
possibleActions.addAll(_game.getActionsEnvironment().getOptionalAfterActions(activePlayer, _effectResult));
if (possibleActions.size() > 0) {

View File

@@ -171,6 +171,7 @@ var GempLotrGameUI = Class.extend({
},
addBottomLeftTabPane: function() {
var that = this;
this.tabPane = $("<div><ul><li><a href='#chatBox'>Chat</a></li><li><a href='#settingsBox'>Settings</a></li></ul><div id='chatBox'></div><div id='settingsBox'></div></div>").tabs();
$("#main").append(this.tabPane);
@@ -240,21 +241,21 @@ var GempLotrGameUI = Class.extend({
initializeDialogs: function() {
this.smallDialog = $("<div></div>")
.dialog({
autoOpen: false,
closeOnEscape: false,
resizable: false,
width: 400,
height: 200
});
autoOpen: false,
closeOnEscape: false,
resizable: false,
width: 400,
height: 200
});
this.cardActionDialog = $("<div></div>")
.dialog({
autoOpen: false,
closeOnEscape: false,
resizable: true,
width: 600,
height: 300
});
autoOpen: false,
closeOnEscape: false,
resizable: true,
width: 600,
height: 300
});
var that = this;
@@ -266,15 +267,15 @@ var GempLotrGameUI = Class.extend({
this.infoDialog = $("<div></div>")
.dialog({
autoOpen: false,
closeOnEscape: true,
resizable: true,
title: "Card information",
minHeight: 80,
minWidth: 200,
width: 600,
height: 300
});
autoOpen: false,
closeOnEscape: true,
resizable: true,
title: "Card information",
minHeight: 80,
minWidth: 200,
width: 600,
height: 300
});
var swipeOptions = {
threshold: 20,
@@ -552,9 +553,9 @@ var GempLotrGameUI = Class.extend({
else if (zone == "DISCARD")
$("#discard" + this.getPlayerIndex(playerId)).text("Discard: " + count);
else if (zone == "DEAD")
$("#deadPile" + this.getPlayerIndex(playerId)).text("Dead pile: " + count);
else if (zone == "DECK")
$("#deck" + this.getPlayerIndex(playerId)).text("Deck: " + count);
$("#deadPile" + this.getPlayerIndex(playerId)).text("Dead pile: " + count);
else if (zone == "DECK")
$("#deck" + this.getPlayerIndex(playerId)).text("Deck: " + count);
},
playerPosition: function(element) {
@@ -708,7 +709,7 @@ var GempLotrGameUI = Class.extend({
if (index != -1)
cardData.attachedCards.splice(index, 1);
}
);
);
var card = $(".card:cardId(" + cardId + ")");
var cardData = card.data("card");
@@ -829,7 +830,7 @@ var GempLotrGameUI = Class.extend({
if (index != -1)
cardData.attachedCards.splice(index, 1);
}
);
);
}
card.remove();
@@ -901,13 +902,13 @@ var GempLotrGameUI = Class.extend({
this.smallDialog
.html(text + "<br /><input id='integerDecision' type='text' value='0'>")
.dialog("option", "buttons",
{
"OK": function() {
$(this).dialog("close");
that.decisionFunction(id, $("#integerDecision").val());
}
}
);
{
"OK": function() {
$(this).dialog("close");
that.decisionFunction(id, $("#integerDecision").val());
}
}
);
$("#integerDecision").SpinnerControl({ type: 'range',
typedata: {
@@ -939,13 +940,13 @@ var GempLotrGameUI = Class.extend({
this.smallDialog
.html(html)
.dialog("option", "buttons",
{
"OK": function() {
$(this).dialog("close");
that.decisionFunction(id, $("#multipleChoiceDecision").val());
}
}
);
{
"OK": function() {
$(this).dialog("close");
that.decisionFunction(id, $("#multipleChoiceDecision").val());
}
}
);
this.smallDialog.dialog("open");
},
@@ -1022,6 +1023,7 @@ var GempLotrGameUI = Class.extend({
};
var resetChoice = function() {
selectedCardIds = new Array();
that.clearSelection();
allowSelection();
processButtons();
@@ -1094,13 +1096,13 @@ var GempLotrGameUI = Class.extend({
$("#ClearSelection").remove();
$("#Done").remove();
if (selectedCardIds.size() == 0) {
if (selectedCardIds.length == 0) {
that.alert.append("<button id='Pass'>Pass</button>");
$("#Pass").button().click(function() {
finishChoice();
});
}
if (selectedCardIds.size() > 0) {
if (selectedCardIds.length > 0) {
that.alert.append("<button id='ClearSelection'>Clear selection</button>");
that.alert.append("<button id='Done'>Done</button>");
$("#Done").button().click(function() {
@@ -1119,6 +1121,7 @@ var GempLotrGameUI = Class.extend({
};
var resetChoice = function() {
selectedCardIds = new Array();
that.clearSelection();
allowSelection();
processButtons();