Adding vitality display and fixing issues with Ring bearer having wrong stats during playing starting fellowship.
This commit is contained in:
@@ -39,7 +39,7 @@ public class Card4_116 extends AbstractCompanion {
|
||||
new Condition() {
|
||||
@Override
|
||||
public boolean isFullfilled(GameState gameState, ModifiersQuerying modifiersQuerying) {
|
||||
return gameState.getCurrentPhase() == Phase.GAME_SETUP;
|
||||
return gameState.getCurrentPhase() == Phase.PLAY_STARTING_FELLOWSHIP;
|
||||
}
|
||||
}, -1));
|
||||
modifiers.add(
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Card4_130 extends AbstractCompanion {
|
||||
|
||||
@Override
|
||||
public int getTwilightCostModifier(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) {
|
||||
if (gameState.getCurrentPhase() == Phase.GAME_SETUP)
|
||||
if (gameState.getCurrentPhase() == Phase.PLAY_STARTING_FELLOWSHIP)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Card4_265 extends AbstractCompanion {
|
||||
|
||||
@Override
|
||||
public int getTwilightCostModifier(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) {
|
||||
if (gameState.getCurrentPhase() == Phase.GAME_SETUP)
|
||||
if (gameState.getCurrentPhase() == Phase.PLAY_STARTING_FELLOWSHIP)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Card5_031 extends AbstractCompanion {
|
||||
Filters.and(
|
||||
Filters.not(Filters.sameCard(self)),
|
||||
Keyword.KNIGHT
|
||||
), new PhaseCondition(Phase.GAME_SETUP), -1));
|
||||
), new PhaseCondition(Phase.PLAY_STARTING_FELLOWSHIP), -1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Card6_121 extends AbstractCompanion {
|
||||
|
||||
@Override
|
||||
public int getTwilightCostModifier(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard self) {
|
||||
if (gameState.getCurrentPhase() == Phase.GAME_SETUP)
|
||||
if (gameState.getCurrentPhase() == Phase.PLAY_STARTING_FELLOWSHIP)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public enum Phase {
|
||||
GAME_SETUP, FELLOWSHIP, SHADOW, MANEUVER, ARCHERY, ASSIGNMENT, SKIRMISH, REGROUP, BETWEEN_TURNS
|
||||
PUT_RING_BEARER, PLAY_STARTING_FELLOWSHIP, FELLOWSHIP, SHADOW, MANEUVER, ARCHERY, ASSIGNMENT, SKIRMISH, REGROUP, BETWEEN_TURNS
|
||||
}
|
||||
|
||||
@@ -76,15 +76,17 @@ public class EventSerializer {
|
||||
eventElem.appendChild(playerZonesElem);
|
||||
}
|
||||
|
||||
Map<Integer, Integer> charVitalities = gameStats.getCharVitalities();
|
||||
|
||||
StringBuilder charStr = new StringBuilder();
|
||||
for (Map.Entry<Integer, Integer> characters : gameStats.getCharStrengths().entrySet()) {
|
||||
charStr.append("," + characters.getKey() + "=" + characters.getValue());
|
||||
charStr.append("," + characters.getKey() + "=" + characters.getValue() + "|" + charVitalities.get(characters.getKey()));
|
||||
}
|
||||
if (charStr.length() > 0)
|
||||
charStr.delete(0, 1);
|
||||
|
||||
if (charStr.length() > 0)
|
||||
eventElem.setAttribute("charStrengths", charStr.toString());
|
||||
eventElem.setAttribute("charStats", charStr.toString());
|
||||
}
|
||||
|
||||
return eventElem;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class GameState {
|
||||
private Map<Integer, PhysicalCardImpl> _allCards = new HashMap<Integer, PhysicalCardImpl>();
|
||||
|
||||
private String _currentPlayerId;
|
||||
private Phase _currentPhase = Phase.GAME_SETUP;
|
||||
private Phase _currentPhase = Phase.PUT_RING_BEARER;
|
||||
private int _twilightPool;
|
||||
|
||||
private int _moveCount;
|
||||
@@ -299,7 +299,7 @@ public class GameState {
|
||||
Zone zone = card.getZone();
|
||||
|
||||
if (zone.isInPlay())
|
||||
if (card.getBlueprint().getCardType() != CardType.SITE || (getCurrentPhase() != Phase.GAME_SETUP && getCurrentSite() == card))
|
||||
if (card.getBlueprint().getCardType() != CardType.SITE || (getCurrentPhase() != Phase.PLAY_STARTING_FELLOWSHIP && getCurrentSite() == card))
|
||||
stopAffecting(card);
|
||||
else if (zone == Zone.STACKED)
|
||||
stopAffectingStacked(card);
|
||||
@@ -358,11 +358,13 @@ public class GameState {
|
||||
listener.cardCreated(card);
|
||||
}
|
||||
|
||||
if (zone.isInPlay()) {
|
||||
if (card.getBlueprint().getCardType() != CardType.SITE || (getCurrentPhase() != Phase.GAME_SETUP && getCurrentSite() == card))
|
||||
startAffecting(game, card);
|
||||
} else if (zone == Zone.STACKED)
|
||||
startAffectingStacked(game, card);
|
||||
if (_currentPhase != Phase.PUT_RING_BEARER) {
|
||||
if (zone.isInPlay()) {
|
||||
if (card.getBlueprint().getCardType() != CardType.SITE || (getCurrentPhase() != Phase.PLAY_STARTING_FELLOWSHIP && getCurrentSite() == card))
|
||||
startAffecting(game, card);
|
||||
} else if (zone == Zone.STACKED)
|
||||
startAffectingStacked(game, card);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeAllTokens(PhysicalCard card) {
|
||||
@@ -673,7 +675,7 @@ public class GameState {
|
||||
}
|
||||
|
||||
// Current site is affecting
|
||||
if (_currentPhase != Phase.GAME_SETUP)
|
||||
if (_currentPhase != Phase.PLAY_STARTING_FELLOWSHIP)
|
||||
startAffecting(game, getCurrentSite());
|
||||
|
||||
// Stacked cards on active cards are stack-affecting
|
||||
|
||||
@@ -171,7 +171,7 @@ public class DefaultLotroGame implements LotroGame {
|
||||
@Override
|
||||
public void checkLoseConditions() {
|
||||
GameState gameState = getGameState();
|
||||
if (gameState != null && gameState.getCurrentPhase() != Phase.GAME_SETUP && gameState.getCurrentPhase() != Phase.BETWEEN_TURNS) {
|
||||
if (gameState != null && gameState.getCurrentPhase() != Phase.PLAY_STARTING_FELLOWSHIP && gameState.getCurrentPhase() != Phase.BETWEEN_TURNS && gameState.getCurrentPhase() != Phase.PUT_RING_BEARER) {
|
||||
// Ring-bearer death
|
||||
if (!Filters.canSpot(gameState, getModifiersQuerying(), Filters.keyword(Keyword.RING_BEARER))) {
|
||||
playerLost(getGameState().getCurrentPlayerId(), "The Ring-Bearer is dead");
|
||||
|
||||
@@ -23,6 +23,7 @@ public class GameStats {
|
||||
|
||||
private Map<String, Map<Zone, Integer>> _zoneSizes = new HashMap<String, Map<Zone, Integer>>();
|
||||
private Map<Integer, Integer> _charStrengths = new HashMap<Integer, Integer>();
|
||||
private Map<Integer, Integer> _charVitalities = new HashMap<Integer, Integer>();
|
||||
|
||||
/**
|
||||
* @return If the stats have changed
|
||||
@@ -85,14 +86,22 @@ public class GameStats {
|
||||
}
|
||||
|
||||
Map<Integer, Integer> newCharStrengths = new HashMap<Integer, Integer>();
|
||||
for (PhysicalCard character : Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.or(CardType.COMPANION, CardType.ALLY, CardType.MINION)))
|
||||
Map<Integer, Integer> newCharVitalities = new HashMap<Integer, Integer>();
|
||||
for (PhysicalCard character : Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.or(CardType.COMPANION, CardType.ALLY, CardType.MINION))) {
|
||||
newCharStrengths.put(character.getCardId(), game.getModifiersQuerying().getStrength(game.getGameState(), character));
|
||||
newCharVitalities.put(character.getCardId(), game.getModifiersQuerying().getVitality(game.getGameState(), character));
|
||||
}
|
||||
|
||||
if (!newCharStrengths.equals(_charStrengths)) {
|
||||
changed = true;
|
||||
_charStrengths = newCharStrengths;
|
||||
}
|
||||
|
||||
if (!newCharVitalities.equals(_charVitalities)) {
|
||||
changed = true;
|
||||
_charVitalities = newCharVitalities;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
@@ -128,6 +137,10 @@ public class GameStats {
|
||||
return Collections.unmodifiableMap(_charStrengths);
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getCharVitalities() {
|
||||
return _charVitalities;
|
||||
}
|
||||
|
||||
public GameStats makeACopy() {
|
||||
GameStats copy = new GameStats();
|
||||
copy._fellowshipArchery = _fellowshipArchery;
|
||||
@@ -138,6 +151,7 @@ public class GameStats {
|
||||
copy._shadowSkirmishStrength = _shadowSkirmishStrength;
|
||||
copy._zoneSizes = _zoneSizes;
|
||||
copy._charStrengths = _charStrengths;
|
||||
copy._charVitalities = _charVitalities;
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gempukku.lotro.logic.timing.processes.pregame;
|
||||
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.common.Zone;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
@@ -39,6 +40,7 @@ public class PlayRingBearerRingAndAddBurdersGameProcess implements GameProcess {
|
||||
gameState.startPlayerTurn(playerId);
|
||||
gameState.addBurdens(_bids.get(playerId));
|
||||
}
|
||||
gameState.setCurrentPhase(Phase.PLAY_STARTING_FELLOWSHIP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,7 +76,7 @@ public class LotroGameMediator {
|
||||
public String getGameStatus() {
|
||||
if (_lotroGame.getWinnerPlayerId() != null)
|
||||
return "Finished";
|
||||
if (_lotroGame.getGameState().getCurrentPhase() == Phase.GAME_SETUP)
|
||||
if (_lotroGame.getGameState().getCurrentPhase() == Phase.PLAY_STARTING_FELLOWSHIP)
|
||||
return "Preparation";
|
||||
return "Playing";
|
||||
}
|
||||
|
||||
@@ -32,9 +32,19 @@
|
||||
.cardStrength {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
background-color: #ffffff;
|
||||
background-color: #7a6a53;
|
||||
opacity: 0.7;
|
||||
color: #000000;
|
||||
font-weight: bolder;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.cardVitality {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
background-color: #8a1f0d;
|
||||
opacity: 0.7;
|
||||
font-weight: bolder;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.selectableCard > .borderOverlay {
|
||||
|
||||
@@ -685,15 +685,17 @@ var GameAnimations = Class.extend({
|
||||
$("#main").queue(
|
||||
function(next) {
|
||||
$(".cardStrength").css({display: "none"});
|
||||
$(".cardVitality").css({display: "none"});
|
||||
|
||||
var charStrengths = element.getAttribute("charStrengths");
|
||||
if (charStrengths != null) {
|
||||
var charStrengthsArr = charStrengths.split(",");
|
||||
for (var i = 0; i < charStrengthsArr.length; i++) {
|
||||
var cardStrength = charStrengthsArr[i].split("=");
|
||||
var cardDiv = $(".card:cardId(" + cardStrength[0] + ")");
|
||||
cardDiv.data("card").strength = cardStrength[1];
|
||||
$(".cardStrength", cardDiv).html(cardStrength[1]).css({display: ""});
|
||||
var charStats = element.getAttribute("charStats");
|
||||
if (charStats != null) {
|
||||
var charStatsArr = charStats.split(",");
|
||||
for (var i = 0; i < charStatsArr.length; i++) {
|
||||
var cardStats = charStatsArr[i].split("=");
|
||||
var cardDiv = $(".card:cardId(" + cardStats[0] + ")");
|
||||
var cardStatArr = cardStats[1].split("|");
|
||||
$(".cardStrength", cardDiv).html(cardStatArr[0]).css({display: ""});
|
||||
$(".cardVitality", cardDiv).html(cardStatArr[1]).css({display: ""});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -781,10 +781,15 @@ var GempLotrGameUI = Class.extend({
|
||||
var cardDiv = createCardDiv(card.imageUrl, text, foil);
|
||||
|
||||
var tokenOverlay = $(".tokenOverlay", cardDiv);
|
||||
|
||||
var cardStrengthDiv = $("<div class='cardStrength'></div>");
|
||||
cardStrengthDiv.css({display: "none"});
|
||||
tokenOverlay.append(cardStrengthDiv);
|
||||
|
||||
var cardVitalityDiv = $("<div class='cardVitality'></div>");
|
||||
cardVitalityDiv.css({display: "none"});
|
||||
tokenOverlay.append(cardVitalityDiv);
|
||||
|
||||
cardDiv.data("card", card);
|
||||
|
||||
var sizeListeners = new Array();
|
||||
@@ -797,7 +802,8 @@ var GempLotrGameUI = Class.extend({
|
||||
var fontPerc = (size * 7) + "%";
|
||||
var borderRadius = Math.ceil(size / 5) + "px";
|
||||
|
||||
$(".cardStrength", cardElem).css({position: "absolute", "border-radius": borderRadius, "font-size": fontPerc, left: borderWidth * 1.4 + "px", top: maxDimension * 0.64 + "px", width: size, height: size});
|
||||
$(".cardStrength", cardElem).css({position: "absolute", "border-radius": borderRadius, "font-size": fontPerc, left: borderWidth * 1.45 + "px", top: maxDimension * 0.64 + "px", width: size, height: size});
|
||||
$(".cardVitality", cardElem).css({position: "absolute", "border-radius": borderRadius, "font-size": fontPerc, left: borderWidth * 1.45 + "px", top: maxDimension * 0.645 + size + "px", width: size, height: size});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ var Card = Class.extend({
|
||||
owner: null,
|
||||
siteNumber: null,
|
||||
attachedCards: null,
|
||||
strength: null,
|
||||
|
||||
init: function(blueprintId, zone, cardId, owner, siteNumber) {
|
||||
this.blueprintId = blueprintId;
|
||||
|
||||
Reference in New Issue
Block a user