Adding skirmish strength visualisation.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.gempukku.lotro.game;
|
||||
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.game.state.Skirmish;
|
||||
import com.gempukku.lotro.logic.decisions.AwaitingDecision;
|
||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
@@ -155,6 +157,23 @@ public class LotroGameMediator {
|
||||
secondsLeft.put(player, _maxSecondsForGamePerPlayer - playerClock.getValue() - getCurrentUserPendingTime(player));
|
||||
}
|
||||
visitor.visitClock(secondsLeft);
|
||||
|
||||
GameState gameState = _lotroGame.getGameState();
|
||||
if (gameState != null) {
|
||||
Skirmish skirmish = gameState.getSkirmish();
|
||||
if (skirmish != null) {
|
||||
int fpStrength = 0;
|
||||
PhysicalCard fpChar = skirmish.getFellowshipCharacter();
|
||||
if (fpChar != null)
|
||||
fpStrength = _lotroGame.getModifiersQuerying().getStrength(gameState, fpChar);
|
||||
|
||||
int minionStrength = 0;
|
||||
for (PhysicalCard minion : skirmish.getShadowCharacters())
|
||||
minionStrength += _lotroGame.getModifiersQuerying().getStrength(gameState, minion);
|
||||
|
||||
visitor.visitSkirmishStats(fpStrength, minionStrength);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
visitor.visitGameEvent(new GameEvent(GameEvent.Type.WARNING).message("Your browser was inactive for too long, please refresh your browser window to continue playing"));
|
||||
}
|
||||
|
||||
@@ -10,4 +10,6 @@ public interface ParticipantCommunicationVisitor {
|
||||
public void visitAwaitingDecision(AwaitingDecision awaitingDecision);
|
||||
|
||||
public void visitGameEvent(GameEvent gameEvent);
|
||||
|
||||
public void visitSkirmishStats(int fpStrength, int shadowStrength);
|
||||
}
|
||||
|
||||
@@ -517,6 +517,14 @@ public class ServerResource {
|
||||
public void visitClock(Map<String, Integer> secondsLeft) {
|
||||
_element.appendChild(serializeClocks(_doc, secondsLeft));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSkirmishStats(int fpStrength, int shadowStrength) {
|
||||
Element skirmish = _doc.createElement("skirmish");
|
||||
skirmish.setAttribute("fpStrength", String.valueOf(fpStrength));
|
||||
skirmish.setAttribute("shadowStrength", String.valueOf(shadowStrength));
|
||||
_element.appendChild(skirmish);
|
||||
}
|
||||
}
|
||||
|
||||
private Node serializeClocks(Document doc, Map<String, Integer> secondsLeft) {
|
||||
|
||||
@@ -55,8 +55,14 @@
|
||||
}
|
||||
|
||||
.skirmish {
|
||||
border-width: 3px;
|
||||
border-color: #ff0000;
|
||||
}
|
||||
|
||||
.fpStrength, .shadowStrength {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
background-color: #ffffff;
|
||||
opacity: 0.5;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#chatBox {
|
||||
|
||||
@@ -24,6 +24,8 @@ var GempLotrGameUI = Class.extend({
|
||||
specialGroup: null,
|
||||
|
||||
skirmishGroupDiv: null,
|
||||
fpStrengthDiv: null,
|
||||
shadowStrengthDiv: null,
|
||||
skirmishShadowGroup: null,
|
||||
skirmishFellowshipGroup: null,
|
||||
|
||||
@@ -197,21 +199,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;
|
||||
|
||||
@@ -223,15 +225,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,
|
||||
@@ -302,9 +304,13 @@ var GempLotrGameUI = Class.extend({
|
||||
if (currentPlayerTurn) {
|
||||
this.skirmishShadowGroup.setBounds(x + 3, y + 3, groupWidth - 6, heightScales[2] * heightPerScale - 6);
|
||||
this.skirmishFellowshipGroup.setBounds(x + 3, y + heightScales[2] * heightPerScale + padding + 3, groupWidth - 6, heightScales[3] * heightPerScale - 6);
|
||||
this.fpStrengthDiv.css({left: 2 + "px", top: groupWidth - 20 - 2 + "px", width: 20, height: 20});
|
||||
this.shadowStrengthDiv.css({left: 2 + "px", top: 2 + "px", width: 20, height: 20});
|
||||
} else {
|
||||
this.skirmishFellowshipGroup.setBounds(x + 3, y + 3, groupWidth - 6, heightScales[1] * heightPerScale - 6);
|
||||
this.skirmishShadowGroup.setBounds(x + 3, y + heightScales[1] * heightPerScale + padding + 3, groupWidth - 6, heightScales[2] * heightPerScale - 6);
|
||||
this.shadowStrengthDiv.css({left: 2 + "px", top: groupWidth - 20 - 2 + "px", width: 20, height: 20});
|
||||
this.fpStrengthDiv.css({left: 2 + "px", top: 2 + "px", width: 20, height: 20});
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -395,6 +401,12 @@ var GempLotrGameUI = Class.extend({
|
||||
this.warning(gameEvent);
|
||||
}
|
||||
}
|
||||
var skirmish = element.getElementsByTagName("skirmish")
|
||||
if (skirmish.length > 0) {
|
||||
this.fpStrengthDiv.text(skirmish[0].getAttribute("fpStrength"));
|
||||
this.shadowStrengthDiv.text(skirmish[1].getAttribute("shadowStrength"));
|
||||
}
|
||||
|
||||
if (gameEvents.length > 0)
|
||||
this.layoutUI(true);
|
||||
|
||||
@@ -474,14 +486,21 @@ var GempLotrGameUI = Class.extend({
|
||||
$(this).data("card").skirmish = true;
|
||||
});
|
||||
|
||||
this.fpStrengthDiv = $("<div class='fpStrength'></div>");
|
||||
this.shadowStrengthDiv = $("<div class='shadowStrength'></div>");
|
||||
|
||||
this.skirmishGroupDiv = $("<div class='ui-widget-content skirmish'></div>");
|
||||
this.skirmishGroupDiv.css({"border-radius": "7px", "border-color": "#ff0000"});
|
||||
this.skirmishGroupDiv.append(this.fpStrengthDiv);
|
||||
this.skirmishGroupDiv.append(this.shadowStrengthDiv);
|
||||
$("#main").append(this.skirmishGroupDiv);
|
||||
},
|
||||
|
||||
endSkirmish: function() {
|
||||
this.skirmishGroupDiv.remove();
|
||||
this.skirmishGroupDiv = null;
|
||||
this.fpStrengthDiv = null;
|
||||
this.shadowStrengthDiv = null;
|
||||
|
||||
$(".card").each(function() {
|
||||
var cardData = $(this).data("card");
|
||||
@@ -551,7 +570,7 @@ var GempLotrGameUI = Class.extend({
|
||||
if (index != -1)
|
||||
cardData.attachedCards.splice(index, 1);
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
var card = $(".card:cardId(" + cardId + ")");
|
||||
var cardData = card.data("card");
|
||||
@@ -614,7 +633,7 @@ var GempLotrGameUI = Class.extend({
|
||||
if (index != -1)
|
||||
cardData.attachedCards.splice(index, 1);
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
card.remove();
|
||||
@@ -681,13 +700,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: {
|
||||
@@ -718,13 +737,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");
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user