New UI features

- Added Initiative readout to the game screen
- Added Rule of 4 readout to the game screen (only during the Fellowship phase)
- Increased the size of the action box as a hack for situations where long messages went off the edge
- Fixed the twilight filter not working in the deckbuilder
This commit is contained in:
Christian 'ketura' McCarty
2024-11-26 15:19:56 -06:00
parent f23e0f0701
commit 633b0e0d19
7 changed files with 78 additions and 11 deletions

View File

@@ -835,6 +835,34 @@ var GameAnimations = Class.extend({
$(".shadowArchery").html(shadowArchery);
$(".move").html(moveCount + "/" + moveLimit);
var initiative = element.getAttribute("initiative");
var ruleof4 = element.getAttribute("ruleof4");
if(initiative == "FREE_PEOPLE") {
$("#initiative-player").html("Free Peoples");
}
else {
$("#initiative-player").html("<b>Shadow</b>");
}
if(ruleof4 == null || ruleof4 == "-1") {
$("#ruleof4").hide();
}
else {
$("#ruleof4").show();
$("#ruleof4-count").html(ruleof4);
if(ruleof4 >= "4") {
$("#ruleof4-status").html(" cards.<br/><b>(Rule of 4 limit reached!)</b>");
}
else if(ruleof4 == "1"){
$("#ruleof4-status").html(" card");
}
else {
$("#ruleof4-status").html(" card");
}
}
var playerZones = element.getElementsByTagName("playerZones");
for (var i = 0; i < playerZones.length; i++) {

View File

@@ -335,6 +335,10 @@ var GempLotrGameUI = Class.extend({
this.gameStateElem.append("<div class='twilightPool'>0</div>");
this.gameStateElem.append("<div class='phase'></div>");
this.gameStateElem.append("<div id='clock-1' class='decisionClock'></div>");
this.gameStateElem.append("<br/>");
this.gameStateElem.append("<div id='initiative'>Initiative: <span id='initiative-player'/></div>");
this.gameStateElem.append("<div id='ruleof4'>Rule of 4: <span id='ruleof4-count' /><span id='ruleof4-status' /></div>");
$("#main").append(this.gameStateElem);
@@ -437,7 +441,7 @@ var GempLotrGameUI = Class.extend({
left: "0px",
top: "0px",
width: "100%",
height: "50px",
height: "150px",
scroll: "auto"
});
@@ -445,7 +449,7 @@ var GempLotrGameUI = Class.extend({
this.alertButtons.css({
position: "absolute",
left: "0px",
top: "50px",
top: "150px",
width: "100%",
height: "30px",
scroll: "auto"
@@ -915,7 +919,7 @@ var GempLotrGameUI = Class.extend({
var advPathWidth = Math.min(150, width * 0.1);
var specialUiWidth = 150;
var alertHeight = 80;
var alertHeight = 180;
var chatHeight = 200;

View File

@@ -4,7 +4,6 @@ import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.logic.decisions.AwaitingDecision;
import com.gempukku.lotro.logic.timing.GameStats;
import com.gempukku.lotro.logic.vo.LotroDeck;
import com.mysql.cj.LicenseConfiguration;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -157,6 +156,11 @@ public class EventSerializer {
eventElem.setAttribute("moveLimit", String.valueOf(gameStats.getMoveLimit()));
eventElem.setAttribute("moveCount", String.valueOf(gameStats.getMoveCount()));
eventElem.setAttribute("initiative", String.valueOf(gameStats.getInitiativeSide()));
if(gameStats.getFellowshipCardsDrawn() != -1) {
eventElem.setAttribute("ruleof4", String.valueOf(gameStats.getFellowshipCardsDrawn()));
}
for (Map.Entry<String, Map<Zone, Integer>> playerZoneSizes : gameStats.getZoneSizes().entrySet()) {
final Element playerZonesElem = doc.createElement("playerZones");
@@ -188,10 +192,10 @@ public class EventSerializer {
else if (charResistances.containsKey(charCardId))
charStr.append("|R").append(charResistances.get(charCardId));
}
if (charStr.length() > 0)
if (!charStr.isEmpty())
charStr.delete(0, 1);
if (charStr.length() > 0)
if (!charStr.isEmpty())
eventElem.setAttribute("charStats", charStr.toString());
}

View File

@@ -918,6 +918,14 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
return true;
}
@Override
public int getFellowshipDrawnCards(LotroGame game) {
if(game.getGameState().getCurrentPhase() != Phase.FELLOWSHIP)
return 0;
return _drawnThisPhaseCount;
}
/**
* Rule of 4. "You cannot draw (or take into hand) more than 4 cards during your fellowship phase."
*

View File

@@ -133,6 +133,7 @@ public interface ModifiersQuerying {
boolean canDrawCardNoIncrement(LotroGame game, String playerId);
boolean canDrawCardAndIncrementForRuleOfFour(LotroGame game, String playerId);
int getFellowshipDrawnCards(LotroGame game);
boolean canLookOrRevealCardsInHand(LotroGame game, String revealingPlayerId, String performingPlayerId);

View File

@@ -1,9 +1,6 @@
package com.gempukku.lotro.logic.timing;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Signet;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.LotroCardBlueprint;
import com.gempukku.lotro.game.PhysicalCard;
@@ -24,6 +21,9 @@ public class GameStats {
private int _moveLimit;
private int _moveCount;
private Side _initiative = Side.FREE_PEOPLE;
private int _fellowshipCardsDrawn;
private int _fellowshipSkirmishStrength;
private int _shadowSkirmishStrength;
@@ -87,6 +87,23 @@ public class GameStats {
_moveCount = newMoveCount;
}
if(playerOrder != null) {
Side newInitiative = game.getModifiersQuerying().hasInitiative(game);
if(newInitiative != _initiative) {
changed = true;
_initiative = newInitiative;
}
}
int newFellowshipCardsDrawn = game.getModifiersQuerying().getFellowshipDrawnCards(game);
if(game.getGameState().getCurrentPhase() != Phase.FELLOWSHIP) {
newFellowshipCardsDrawn = -1;
}
if(newFellowshipCardsDrawn != _fellowshipCardsDrawn) {
changed = true;
_fellowshipCardsDrawn = newFellowshipCardsDrawn;
}
int newFellowshipStrength = RuleUtils.getFellowshipSkirmishStrength(game);
if (newFellowshipStrength != _fellowshipSkirmishStrength) {
changed = true;
@@ -231,6 +248,9 @@ public class GameStats {
return _moveCount;
}
public Side getInitiativeSide() { return _initiative; }
public int getFellowshipCardsDrawn() { return _fellowshipCardsDrawn; }
public int getFellowshipSkirmishStrength() {
return _fellowshipSkirmishStrength;
}
@@ -283,6 +303,8 @@ public class GameStats {
copy._fellowshipSkirmishDamageBonus = _fellowshipSkirmishDamageBonus;
copy._moveCount = _moveCount;
copy._moveLimit = _moveLimit;
copy._initiative = _initiative;
copy._fellowshipCardsDrawn = _fellowshipCardsDrawn;
copy._shadowArchery = _shadowArchery;
copy._shadowSkirmishStrength = _shadowSkirmishStrength;
copy._shadowSkirmishDamageBonus = _shadowSkirmishDamageBonus;

View File

@@ -40,7 +40,7 @@ public class SortAndFilterCards {
var races = getEnumFilter(Race.values(), Race.class, params.get("race"), true);
var itemClasses = getEnumFilter(PossessionClass.values(), PossessionClass.class, params.get("itemclass"), true);
var twilight = getStat(params.get("sitenumber"));
var twilight = getStat(params.get("twilight"));
var twilightComparator = getSingleton(params.get("twilightcompare"));
var siteNumber = getStat(params.get("sitenumber"));
var siteNumberComparator = getSingleton(params.get("sitenumbercompare"));