summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.html8
-rw-r--r--play.js55
-rw-r--r--rules.js25
3 files changed, 65 insertions, 23 deletions
diff --git a/play.html b/play.html
index 2398036..ee0d279 100644
--- a/play.html
+++ b/play.html
@@ -276,6 +276,14 @@ body.Teutons #plan_actions .russian { display: none }
filter: grayscale(50%)
}
+.court_body .mat.hidden .background {
+ filter: grayscale(100%)
+}
+
+.court_body .mat.besieged.hidden .background {
+ filter: grayscale(100%) brightness(75%)
+}
+
.mat.command .background {
box-shadow: 0 0 0 1px #584800, 0 0 0 3px gold;
}
diff --git a/play.js b/play.js
index f217cf6..77aa2eb 100644
--- a/play.js
+++ b/play.js
@@ -90,7 +90,6 @@ function make_locale_tip(loc, id) {
}
if (list.length > 0)
tip += " - " + list.join(", ")
- console.log("loc.name", id, loc.name, loc.type, tip, loc.seats)
return tip
}
@@ -1112,13 +1111,26 @@ function update_vassals(ready_parent, mustered_parent, lord_ix) {
}
function update_lord_mat(ix) {
- update_assets(ix, ui.assets[ix], view.pieces.assets[ix])
- update_vassals(ui.ready_vassals[ix], ui.mustered_vassals[ix], ix)
- update_forces(ui.forces[ix], view.pieces.forces[ix], ix, false)
- update_forces(ui.routed[ix], view.pieces.routed[ix], ix, true)
- ui.lord_moved1[ix].classList.toggle("hide", is_levy_phase() || get_lord_moved(ix) < 1)
- ui.lord_moved2[ix].classList.toggle("hide", is_levy_phase() || get_lord_moved(ix) < 2)
- ui.lord_feed_x2[ix].classList.toggle("hide", count_lord_all_forces(ix) <= 6)
+ if (view.reveal & (1 << ix)) {
+ ui.lord_mat[ix].classList.remove("hidden")
+ update_assets(ix, ui.assets[ix], view.pieces.assets[ix])
+ update_vassals(ui.ready_vassals[ix], ui.mustered_vassals[ix], ix)
+ update_forces(ui.forces[ix], view.pieces.forces[ix], ix, false)
+ update_forces(ui.routed[ix], view.pieces.routed[ix], ix, true)
+ ui.lord_moved1[ix].classList.toggle("hide", is_levy_phase() || get_lord_moved(ix) < 1)
+ ui.lord_moved2[ix].classList.toggle("hide", is_levy_phase() || get_lord_moved(ix) < 2)
+ ui.lord_feed_x2[ix].classList.toggle("hide", count_lord_all_forces(ix) <= 6)
+ } else {
+ ui.lord_mat[ix].classList.add("hidden")
+ ui.assets[ix].replaceChildren()
+ ui.ready_vassals[ix].replaceChildren()
+ ui.mustered_vassals[ix].replaceChildren()
+ ui.forces[ix].replaceChildren()
+ ui.routed[ix].replaceChildren()
+ ui.lord_moved1[ix].classList.add("hide")
+ ui.lord_moved2[ix].classList.add("hide")
+ ui.lord_feed_x2[ix].classList.add("hide")
+ }
}
function is_lord_command(ix) {
@@ -1421,20 +1433,21 @@ function update_cards() {
for (let ix = 0; ix < data.lords.length; ++ix) {
let side = ix < 6 ? "teutonic" : "russian"
ui.lord_capabilities[ix].replaceChildren()
- let c = view.pieces.capabilities[(ix << 1) + 0]
- if (c >= 0)
- ui.lord_capabilities[ix].appendChild(ui.cards[c])
- c = view.pieces.capabilities[(ix << 1) + 1]
- if (c >= 0)
- ui.lord_capabilities[ix].appendChild(ui.cards[c])
-
ui.lord_events[ix].replaceChildren()
- if (view.battle && view.battle.field_organ === ix)
- ui.lord_events[ix].appendChild(ui.cards[EVENT_TEUTONIC_FIELD_ORGAN])
- if (view.battle && view.battle.bridge && view.battle.bridge.lord1 === ix)
- ui.lord_events[ix].appendChild(ui.cards[EVENT_RUSSIAN_BRIDGE])
- if (view.battle && view.battle.bridge && view.battle.bridge.lord2 === ix)
- ui.lord_events[ix].appendChild(ui.cards[EVENT_TEUTONIC_BRIDGE])
+ if (view.reveal & (1 << ix)) {
+ let c = view.pieces.capabilities[(ix << 1) + 0]
+ if (c >= 0)
+ ui.lord_capabilities[ix].appendChild(ui.cards[c])
+ c = view.pieces.capabilities[(ix << 1) + 1]
+ if (c >= 0)
+ ui.lord_capabilities[ix].appendChild(ui.cards[c])
+ if (view.battle && view.battle.field_organ === ix)
+ ui.lord_events[ix].appendChild(ui.cards[EVENT_TEUTONIC_FIELD_ORGAN])
+ if (view.battle && view.battle.bridge && view.battle.bridge.lord1 === ix)
+ ui.lord_events[ix].appendChild(ui.cards[EVENT_RUSSIAN_BRIDGE])
+ if (view.battle && view.battle.bridge && view.battle.bridge.lord2 === ix)
+ ui.lord_events[ix].appendChild(ui.cards[EVENT_TEUTONIC_BRIDGE])
+ }
}
}
diff --git a/rules.js b/rules.js
index 5e5f269..3604885 100644
--- a/rules.js
+++ b/rules.js
@@ -1564,7 +1564,7 @@ exports.setup = function (seed, scenario, options) {
game = {
seed,
scenario,
- options,
+ hidden: options.hidden ? 1 : 0,
log: [],
undo: [],
@@ -2096,7 +2096,7 @@ function action_torzhok(lord, asset) {
states.torzhok = {
inactive: "Torzhok",
prompt() {
- // TODO: need to reveal Domash if hidden!
+ view.reveal |= (1 << LORD_DOMASH) // Reveal Domash if hidden mats
if (game.count > 0) {
if (game.count === 3)
view.prompt = "Torzhok: Remove up to 3 Assets from Domash or up to 3 Coin from Veche."
@@ -10890,6 +10890,9 @@ function gen_action_routed_serfs(lord) {
gen_action("routed_serfs", lord)
}
+const P1_LORD_MASK = (1|2|4|8|16|32)
+const P2_LORD_MASK = (1|2|4|8|16|32) << 6
+
exports.view = function (state, current) {
load_state(state)
@@ -10897,6 +10900,7 @@ exports.view = function (state, current) {
prompt: null,
actions: null,
log: game.log,
+ reveal: 0,
turn: game.turn,
end: scenario_last_turn[game.scenario],
@@ -10913,13 +10917,30 @@ exports.view = function (state, current) {
plan: null,
}
+ if (!game.hidden)
+ view.reveal = -1
+
if (current === P1) {
view.hand = game.hand1
view.plan = game.plan1
+ if (game.hidden)
+ view.reveal |= P1_LORD_MASK
}
if (current === P2) {
view.hand = game.hand2
view.plan = game.plan2
+ if (game.hidden)
+ view.reveal |= P2_LORD_MASK
+ }
+
+ if (game.battle) {
+ if (game.battle.array) {
+ for (let lord of game.battle.array)
+ if (lord !== NOBODY)
+ view.reveal |= (1 << lord)
+ }
+ for (let lord of game.battle.reserves)
+ view.reveal |= (1 << lord)
}
if (game.state === "game_over") {