- Players now can setup auto-pass option per phase, by default game auto-passes on all phases except for Shadow

and Skirmish.
This commit is contained in:
marcins78@gmail.com
2012-01-11 19:31:16 +00:00
parent f21f238139
commit 393ed9530e
6 changed files with 83 additions and 72 deletions

View File

@@ -1,5 +1,6 @@
package com.gempukku.lotro.logic.timing.actions;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.game.state.Skirmish;
import com.gempukku.lotro.logic.PlayOrder;
@@ -67,22 +68,30 @@ public class SkirmishActionProcedureAction extends SystemQueueAction {
final List<Action> playableActions = game.getActionsEnvironment().getPhaseActions(playerId);
game.getUserFeedback().sendAwaitingDecision(playerId,
new CardActionSelectionDecision(game, 1, "Choose action to play or Pass", playableActions) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
Action action = getSelectedAction(result);
if (action != null) {
appendEffect(
new CheckIfSkirmishFinishedEffect(_playOrder, 0));
game.getActionsEnvironment().addActionToStack(action);
} else {
if (_consecutivePasses + 1 < _playOrder.getPlayerCount())
if (playableActions.size() == 0 && game.shouldAutoPass(playerId, Phase.SKIRMISH)) {
playerPassed();
} else {
game.getUserFeedback().sendAwaitingDecision(playerId,
new CardActionSelectionDecision(game, 1, "Choose action to play or Pass", playableActions) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
Action action = getSelectedAction(result);
if (action != null) {
appendEffect(
new PlayerPlaysNextActionEffect(_playOrder, _consecutivePasses + 1));
new CheckIfSkirmishFinishedEffect(_playOrder, 0));
game.getActionsEnvironment().addActionToStack(action);
} else {
playerPassed();
}
}
}
});
});
}
}
private void playerPassed() {
if (_consecutivePasses + 1 < _playOrder.getPlayerCount())
appendEffect(
new PlayerPlaysNextActionEffect(_playOrder, _consecutivePasses + 1));
}
}
}

View File

@@ -23,7 +23,7 @@ public class PlayerPlaysPhaseActionsUntilPassesGameProcess implements GameProces
public void process(final LotroGame game) {
final List<Action> playableActions = game.getActionsEnvironment().getPhaseActions(_playerId);
if (playableActions.size() == 0 & game.shouldAutoPass(_playerId, game.getGameState().getCurrentPhase())) {
if (playableActions.size() == 0 && game.shouldAutoPass(_playerId, game.getGameState().getCurrentPhase())) {
playerPassed();
} else {
game.getUserFeedback().sendAwaitingDecision(_playerId,

View File

@@ -42,7 +42,7 @@ public class PlayersPlayPhaseActionsInOrderGameProcess implements GameProcess {
}
final List<Action> playableActions = game.getActionsEnvironment().getPhaseActions(playerId);
if (playableActions.size() == 0 & game.shouldAutoPass(playerId, game.getGameState().getCurrentPhase())) {
if (playableActions.size() == 0 && game.shouldAutoPass(playerId, game.getGameState().getCurrentPhase())) {
playerPassed();
} else {
game.getUserFeedback().sendAwaitingDecision(playerId,

View File

@@ -36,14 +36,14 @@ public class GameResource extends AbstractResource {
@Context
private LotroServer _lotroServer;
private static Set<Phase> _autoPassAll = new HashSet<Phase>();
private static Set<Phase> _autoPassDefault = new HashSet<Phase>();
static {
_autoPassAll.add(Phase.FELLOWSHIP);
_autoPassAll.add(Phase.MANEUVER);
_autoPassAll.add(Phase.ARCHERY);
_autoPassAll.add(Phase.ASSIGNMENT);
_autoPassAll.add(Phase.REGROUP);
_autoPassDefault.add(Phase.FELLOWSHIP);
_autoPassDefault.add(Phase.MANEUVER);
_autoPassDefault.add(Phase.ARCHERY);
_autoPassDefault.add(Phase.ASSIGNMENT);
_autoPassDefault.add(Phase.REGROUP);
}
@Path("/{gameId}")
@@ -76,7 +76,7 @@ public class GameResource extends AbstractResource {
private Set<Phase> getAutoPassPhases(HttpServletRequest request) {
for (Cookie cookie : request.getCookies()) {
if (cookie.getName().equals("autoPassPhases")) {
final String[] phases = cookie.getValue().split(",");
final String[] phases = cookie.getValue().split("0");
Set<Phase> result = new HashSet<Phase>();
for (String phase : phases)
result.add(Phase.valueOf(phase));
@@ -87,7 +87,7 @@ public class GameResource extends AbstractResource {
if (cookie.getName().equals("autoPass") && cookie.getValue().equals("false"))
return Collections.emptySet();
}
return _autoPassAll;
return _autoPassDefault;
}
@Path("/{gameId}/cardInfo")

View File

@@ -1,6 +1,8 @@
<pre style="font-size:80%">
<b>11 Jan. 2012</b>
- "Isengard Sword" now correctly gives -2 Strength to character in skirmish against its bearer.
- Players now can setup auto-pass option per phase, by default game auto-passes on all phases except for Shadow
and Skirmish.
<b>10 Jan. 2012</b>
- "Alcarin" should now correctly be usable only if his cost (assignment) can be payed.

View File

@@ -388,19 +388,19 @@ var GempLotrGameUI = Class.extend({
});
$("#settingsBox").append("Phases when game auto-passes for you, if you have no phase actions to play<br />");
$("#settingsBox").append("<input id='autoPassFELLOWSHIP' type='checkbox' value='selected' /><label for='autoPassFELLOWSHIP'>Fellowship</label><br />");
$("#settingsBox").append("<input id='autoPassSHADOW' type='checkbox' value='selected' /><label for='autoPassSHADOW'>Shadow</label><br />");
$("#settingsBox").append("<input id='autoPassMANEUVER' type='checkbox' value='selected' /><label for='autoPassMANEUVER'>Maneuver</label><br />");
$("#settingsBox").append("<input id='autoPassARCHERY' type='checkbox' value='selected' /><label for='autoPassARCHERY'>Archery</label><br />");
$("#settingsBox").append("<input id='autoPassASSIGNMENT' type='checkbox' value='selected' /><label for='autoPassASSIGNMENT'>Assignment</label><br />");
$("#settingsBox").append("<input id='autoPassSKIRMISH' type='checkbox' value='selected' /><label for='autoPassSKIRMISH'>Skirmish</label><br />");
$("#settingsBox").append("<input id='autoPassREGROUP' type='checkbox' value='selected' /><label for='autoPassREGROUP'>Regroup</label><br />");
$("#settingsBox").append("<input id='autoPassFELLOWSHIP' type='checkbox' value='selected' /><label for='autoPassFELLOWSHIP'>Fellowship</label> ");
$("#settingsBox").append("<input id='autoPassSHADOW' type='checkbox' value='selected' /><label for='autoPassSHADOW'>Shadow</label> ");
$("#settingsBox").append("<input id='autoPassMANEUVER' type='checkbox' value='selected' /><label for='autoPassMANEUVER'>Maneuver</label> ");
$("#settingsBox").append("<input id='autoPassARCHERY' type='checkbox' value='selected' /><label for='autoPassARCHERY'>Archery</label> ");
$("#settingsBox").append("<input id='autoPassASSIGNMENT' type='checkbox' value='selected' /><label for='autoPassASSIGNMENT'>Assignment</label> ");
$("#settingsBox").append("<input id='autoPassSKIRMISH' type='checkbox' value='selected' /><label for='autoPassSKIRMISH'>Skirmish</label> ");
$("#settingsBox").append("<input id='autoPassREGROUP' type='checkbox' value='selected' /><label for='autoPassREGROUP'>Regroup</label>");
var autoPassPhases = $.cookie("autoPassPhases");
if (autoPassPhases == null)
autoPassPhases = "FELLOWSHIP,MANEUVER,ARCHERY,ASSIGNMENT,REGROUP";
autoPassPhases = "FELLOWSHIP0MANEUVER0ARCHERY0ASSIGNMENT0REGROUP";
var passPhasesArr = autoPassPhases.split(",");
var passPhasesArr = autoPassPhases.split("0");
for (var i = 0; i < passPhasesArr.length; i++) {
$("#autoPass" + passPhasesArr[i]).prop("checked", true);
}
@@ -408,23 +408,23 @@ var GempLotrGameUI = Class.extend({
$("#autoPassFELLOWSHIP,#autoPassSHADOW,#autoPassMANEUVER,#autoPassARCHERY,#autoPassASSIGNMENT,#autoPassSKIRMISH,#autoPassREGROUP").bind("change", function() {
var newAutoPassPhases = "";
if ($("#autoPassFELLOWSHIP").prop("checked"))
newAutoPassPhases += ",FELLOWSHIP";
newAutoPassPhases += "0FELLOWSHIP";
if ($("#autoPassSHADOW").prop("checked"))
newAutoPassPhases += ",SHADOW";
newAutoPassPhases += "0SHADOW";
if ($("#autoPassMANEUVER").prop("checked"))
newAutoPassPhases += ",MANEUVER";
newAutoPassPhases += "0MANEUVER";
if ($("#autoPassARCHERY").prop("checked"))
newAutoPassPhases += ",ARCHERY";
newAutoPassPhases += "0ARCHERY";
if ($("#autoPassASSIGNMENT").prop("checked"))
newAutoPassPhases += ",ASSIGNMENT";
newAutoPassPhases += "0ASSIGNMENT";
if ($("#autoPassSKIRMISH").prop("checked"))
newAutoPassPhases += ",SKIRMISH";
newAutoPassPhases += "0SKIRMISH";
if ($("#autoPassREGROUP").prop("checked"))
newAutoPassPhases += ",REGROUP";
newAutoPassPhases += "0REGROUP";
if (newAutoPassPhases.length > 0)
newAutoPassPhases = newAutoPassPhases.substr(1);
$.cookie("autoAcceptPhases", newAutoPassPhases, { expires: 365 });
$.cookie("autoPassPhases", newAutoPassPhases, { expires: 365 });
});
var playerListener = function(players) {
@@ -636,21 +636,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;
@@ -665,11 +665,11 @@ var GempLotrGameUI = Class.extend({
this.infoDialog = $("<div></div>")
.dialog({
autoOpen: false,
closeOnEscape: true,
resizable: false,
title: "Card information"
});
autoOpen: false,
closeOnEscape: true,
resizable: false,
title: "Card information"
});
var swipeOptions = {
threshold: 20,
@@ -1140,12 +1140,12 @@ var GempLotrGameUI = Class.extend({
if (!this.replayMode) {
this.smallDialog.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',
@@ -1183,12 +1183,12 @@ var GempLotrGameUI = Class.extend({
if (!this.replayMode) {
this.smallDialog.dialog("option", "buttons",
{
"OK": function() {
that.smallDialog.dialog("close");
that.decisionFunction(id, $("#multipleChoiceDecision").val());
}
});
{
"OK": function() {
that.smallDialog.dialog("close");
that.decisionFunction(id, $("#multipleChoiceDecision").val());
}
});
}
} else {
this.smallDialog.append("<br />");
@@ -1573,8 +1573,8 @@ var GempLotrGameUI = Class.extend({
$(div).find('LI.hover').removeClass('hover');
$(this).parent().addClass('hover');
}).mouseout(function() {
$(div).find('LI.hover').removeClass('hover');
});
$(div).find('LI.hover').removeClass('hover');
});
var getRidOfContextMenu = function() {
$(div).remove();