Preparation for deck building.

This commit is contained in:
marcins78@gmail.com
2011-09-03 20:42:06 +00:00
parent 82e9f4b9f0
commit f3603f5a97
4 changed files with 19 additions and 20 deletions

View File

@@ -2,12 +2,12 @@ package com.gempukku.lotro.cards.set1.isengard;
import com.gempukku.lotro.cards.AbstractLotroCardBlueprint; import com.gempukku.lotro.cards.AbstractLotroCardBlueprint;
import com.gempukku.lotro.cards.PlayConditions; import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.AddUntilStartOfPhaseModifierEffect; import com.gempukku.lotro.cards.effects.AddUntilStartOfPhaseModifierEffect;
import com.gempukku.lotro.common.*; import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters; import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard; import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame; import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect; import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.modifiers.KeywordModifier; import com.gempukku.lotro.logic.modifiers.KeywordModifier;
import com.gempukku.lotro.logic.timing.Action; import com.gempukku.lotro.logic.timing.Action;
@@ -37,7 +37,7 @@ public class Card1_126 extends AbstractLotroCardBlueprint {
@Override @Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, final PhysicalCard self) { public List<? extends Action> getPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canPlayShadowCardDuringPhase(game, Phase.MANEUVER, self)) { if (PlayConditions.canPlayShadowCardDuringPhase(game, Phase.MANEUVER, self)) {
final CostToEffectAction action = new CostToEffectAction(self, Keyword.MANEUVER, "Make an Uruk-hai fierce until the regroup phase."); final PlayEventAction action = new PlayEventAction(self);
action.addEffect( action.addEffect(
new ChooseActiveCardEffect(playerId, "Choose an Uruk-hai", Filters.keyword(Keyword.URUK_HAI)) { new ChooseActiveCardEffect(playerId, "Choose an Uruk-hai", Filters.keyword(Keyword.URUK_HAI)) {
@Override @Override

View File

@@ -98,9 +98,7 @@
$(document).ready( $(document).ready(
function () { function () {
ui = new GempLotrUI(); communication = new GempLotrCommunication("/gemp-lotr/server",
communication = new GempLotrCommunication("/gemp-lotr/server/game/" + getUrlParam("gameId"),
function(xml) { function(xml) {
ui.processXml(xml); ui.processXml(xml);
}, },

View File

@@ -103,17 +103,18 @@
ui = new GempLotrUI(); ui = new GempLotrUI();
communication = new GempLotrCommunication("/gemp-lotr/server", communication = new GempLotrCommunication("/gemp-lotr/server",
function(xml) {
ui.processXml(xml);
},
function() { function() {
ui.processError(); ui.processError();
}); });
ui.setUpdateState(function() { ui.setUpdateState(function() {
communication.updateGameState(); communication.updateGameState(function(xml) {
ui.processXml(xml);
});
}); });
ui.setDecisionFunction(function(decisionId, result) { ui.setDecisionFunction(function(decisionId, result) {
communication.gameDecisionMade(decisionId, result); communication.gameDecisionMade(decisionId, result, function(xml) {
ui.processXml(xml);
});
}); });
ui.setGetCardModifiers(function(cardId, func) { ui.setGetCardModifiers(function(cardId, func) {
communication.getGameCardModifiers(cardId, func); communication.getGameCardModifiers(cardId, func);
@@ -124,7 +125,9 @@
ui.layoutUI(); ui.layoutUI();
}); });
communication.startGameSession(); communication.startGameSession(function(xml) {
ui.processXml(xml);
});
}); });
</script> </script>

View File

@@ -1,32 +1,30 @@
var GempLotrCommunication = Class.extend({ var GempLotrCommunication = Class.extend({
url: null, url: null,
success: null,
failure: null, failure: null,
init: function(url, success, failure) { init: function(url, failure) {
this.url = url; this.url = url;
this.success = success;
this.failure = failure; this.failure = failure;
}, },
startGameSession: function() { startGameSession: function(callback) {
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: this.url + "/game/" + getUrlParam("gameId"), url: this.url + "/game/" + getUrlParam("gameId"),
cache: false, cache: false,
data: { participantId: getUrlParam("participantId") }, data: { participantId: getUrlParam("participantId") },
success: this.success, success: callback,
error: this.failure, error: this.failure,
dataType: "xml" dataType: "xml"
}); });
}, },
updateGameState: function() { updateGameState: function(callback) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: this.url + "/game/" + getUrlParam("gameId"), url: this.url + "/game/" + getUrlParam("gameId"),
cache: false, cache: false,
data: { participantId: getUrlParam("participantId") }, data: { participantId: getUrlParam("participantId") },
success: this.success, success: callback,
error: this.failure, error: this.failure,
dataType: "xml" dataType: "xml"
}); });
@@ -43,7 +41,7 @@ var GempLotrCommunication = Class.extend({
dataType: "html" dataType: "html"
}); });
}, },
gameDecisionMade: function(decisionId, response) { gameDecisionMade: function(decisionId, response, callback) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: this.url + "/game/" + getUrlParam("gameId"), url: this.url + "/game/" + getUrlParam("gameId"),
@@ -52,7 +50,7 @@ var GempLotrCommunication = Class.extend({
participantId: getUrlParam("participantId"), participantId: getUrlParam("participantId"),
decisionId: decisionId, decisionId: decisionId,
decisionValue: response}, decisionValue: response},
success: this.success, success: callback,
error: this.failure, error: this.failure,
dataType: "xml" dataType: "xml"
}); });