summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.js12
-rw-r--r--play.html10
-rw-r--r--play.js14
-rw-r--r--rules.js75
-rw-r--r--tools/gendata.js12
5 files changed, 105 insertions, 18 deletions
diff --git a/data.js b/data.js
index e43bc54..52eef6f 100644
--- a/data.js
+++ b/data.js
@@ -200,9 +200,9 @@ cards:[
{"name":"T16","event":"Famine","when":"this_campaign","capability":"Ransom","this_lord":false,"lords":null},
{"name":"T17","event":"Dietrich von Grüningen","when":"hold","capability":"Stonemasons","this_lord":true,"lords":[0,1,2,3,4,5]},
{"name":"T18","event":"Swedish Crusade","when":"now","capability":"Cogs","this_lord":true,"lords":[0,1,3]},
-{"name":"T0","event":"No Event","when":"now","capability":null,"this_lord":false,"lords":null},
-{"name":"T0","event":"No Event","when":"now","capability":null,"this_lord":false,"lords":null},
-{"name":"T0","event":"No Event","when":"now","capability":null,"this_lord":false,"lords":null},
+{"name":"T0","event":"No Event","when":"never","capability":null,"this_lord":false,"lords":null},
+{"name":"T0","event":"No Event","when":"never","capability":null,"this_lord":false,"lords":null},
+{"name":"T0","event":"No Event","when":"never","capability":"No Capability","this_lord":false,"lords":null},
{"name":"R1","event":"Bridge","when":"hold","capability":"Luchniki","this_lord":true,"lords":[8,9,10,11]},
{"name":"R2","event":"Marsh","when":"hold","capability":"Luchniki","this_lord":true,"lords":[8,9,10,11]},
{"name":"R3","event":"Pogost","when":"hold","capability":"Streltsy","this_lord":true,"lords":[6,7,8,9,11]},
@@ -221,9 +221,9 @@ cards:[
{"name":"R16","event":"Tempest","when":"now","capability":"Lodya","this_lord":true,"lords":[6,7,8,9,10,11]},
{"name":"R17","event":"Dietrich von Grüningen","when":"this_levy","capability":"Veliky Knyaz","this_lord":true,"lords":[6,7,8,9,10,11]},
{"name":"R18","event":"Bountiful Harvest","when":"now","capability":"Stone Kremlin","this_lord":true,"lords":[6,7,8,9,10,11]},
-{"name":"R0","event":"No Event","capability":null,"this_lord":false,"lords":null},
-{"name":"R0","event":"No Event","capability":null,"this_lord":false,"lords":null},
-{"name":"R0","event":"No Event","capability":null,"this_lord":false,"lords":null},
+{"name":"R0","event":"No Event","when":"never","capability":null,"this_lord":false,"lords":null},
+{"name":"R0","event":"No Event","when":"never","capability":null,"this_lord":false,"lords":null},
+{"name":"R0","event":"No Event","when":"never","capability":"No Capability","this_lord":false,"lords":null},
],
}
if (typeof module !== 'undefined') module.exports = data
diff --git a/play.html b/play.html
index 7285fba..d8b9487 100644
--- a/play.html
+++ b/play.html
@@ -104,8 +104,8 @@ header.your_turn { background-color: orange; }
display: flex;
flex-wrap: wrap;
justify-content: center;
- gap: 12px;
- padding: 18px;
+ gap: 12px 6px;
+ padding: 18px 0;
}
#plan_actions {
@@ -220,10 +220,15 @@ body.shift .capabilities {
}
.mat .mustered_vassals {
+ display: none;
position: absolute;
z-index: 5;
}
+body.shift .mustered_vassals {
+ display: block;
+}
+
.mat .ready_vassals .service_marker {
margin-top: -8px;
}
@@ -422,6 +427,7 @@ X.mat .mustered_vassals { top: 228px; right: 6px; width: 94px; }
.marker.pursuit.russian { background-image: url(images/marker_pursuit_russian.png) }
.marker.castle.russian { background-image: url(images/marker_castle_russian.png) }
.marker.castle.teutonic { background-image: url(images/marker_castle_teutonic.png) }
+.marker.walls { background-image: url(images/marker_walls.a.png) }
.marker.sea_trade_blocked { background-image: url(images/marker_sea_trade_blocked.a.png) }
.marker.number.teutonic.n1 { background-image: url(images/marker_1_teutonic.png) }
diff --git a/play.js b/play.js
index a1c24ec..6a04d40 100644
--- a/play.js
+++ b/play.js
@@ -156,6 +156,7 @@ function is_p2_locale(loc) {
function count_vp1() {
let vp = 0
for (let loc of view.castles)
+ // TODO: captured by russians?
if (is_p2_locale(loc))
vp += 2
for (let loc of view.conquered)
@@ -170,6 +171,7 @@ function count_vp1() {
function count_vp2() {
let vp = view.veche_vp * 2
for (let loc of view.castles)
+ // TODO: captured by russians?
if (is_p1_locale(loc))
vp += 2
for (let loc of view.conquered)
@@ -647,16 +649,21 @@ function update_locale(loc) {
if (set_has(view.castles, loc)) {
let cn
- if (is_p1_locale(loc))
+ // TODO: captured by russians?
+ if (false)
cn = "marker rectangle castle russian"
else
cn = "marker rectangle castle teutonic"
ui.locale_markers[loc].appendChild(get_cached_element(cn))
}
+ if (set_has(view.walls, loc)) {
+ let cn = "marker square walls"
+ ui.locale_markers[loc].appendChild(get_cached_element(cn))
+ }
+
if (view.sieges[loc]) {
let cn
- // TODO: castle?
if (is_p1_locale(loc))
cn = "marker square siege russian"
else
@@ -848,7 +855,10 @@ function on_update() {
action_button("capability", "Capability")
action_button("discard", "Discard")
+ action_button("play", "Play")
+ action_button("hold", "Hold")
action_button("deploy", "Deploy")
+
action_button("done", "Done")
action_button("unfed", "Unfed")
action_button("end_plan", "End plan")
diff --git a/rules.js b/rules.js
index 8510087..7d8dc29 100644
--- a/rules.js
+++ b/rules.js
@@ -480,6 +480,7 @@ function muster_vassal(lord, vassal) {
}
exports.setup = function (seed, scenario, options) {
+ console.log("DO SETUP", seed, scenario)
game = {
seed,
scenario,
@@ -517,9 +518,11 @@ exports.setup = function (seed, scenario, options) {
conquered: [],
ravaged: [],
- castles: [],
sieges: {},
+ castles: [],
+ walls: [],
+
command: NOBODY,
who: NOBODY,
where: NOWHERE,
@@ -528,6 +531,8 @@ exports.setup = function (seed, scenario, options) {
count: 0,
}
+ update_aliases()
+
log_h1(scenario)
switch (scenario) {
@@ -780,6 +785,7 @@ function setup_pleskau_quickstart() {
states.setup_lords = {
prompt() {
view.prompt = "Setup your Lords."
+ console.log("SETUP", game.lords.moved)
let done = true
for (let lord = first_friendly_lord; lord <= last_friendly_lord; ++lord) {
if (is_lord_on_map(lord) && !get_lord_moved(lord)) {
@@ -905,7 +911,69 @@ function end_levy_arts_of_war_first() {
// === LEVY: ARTS OF WAR ===
+function goto_levy_arts_of_war() {
+ log_h1("Levy " + current_turn_name())
+ game.state = 'levy_arts_of_war'
+ game.what = draw_two_arts_of_war_cards()
+}
+
+function resume_levy_arts_of_war() {
+ if (game.what.length === 0)
+ end_levy_arts_of_war()
+}
+
states.levy_arts_of_war = {
+ prompt() {
+ let c = game.what[0]
+ view.what = c
+ switch (data.cards[c].when) {
+ case "this_levy":
+ case "this_campaign":
+ case "now":
+ view.prompt = `Play ${data.cards[c].event}.`
+ view.actions.play = 1
+ break
+ case "hold":
+ view.prompt = `Hold ${data.cards[c].event}.`
+ view.actions.hold = 1
+ break
+ case "never":
+ view.prompt = `Discard ${data.cards[c].event}.`
+ view.actions.discard = 1
+ break
+ }
+ },
+ play() {
+ let c = game.what.shift()
+ log(`Played #${c} ${data.cards[c].event}.`)
+ if (data.cards[c].when === "this_levy" || data.cards[c].when === "this_campaign")
+ set_add(game.events, c)
+ log(`TODO implement event`)
+ resume_levy_arts_of_war()
+ },
+ hold() {
+ let c = game.what.shift()
+ log(`Held event card.`)
+ if (game.active === P1)
+ set_add(game.p1_hand, c)
+ else
+ set_add(game.p2_hand, c)
+ resume_levy_arts_of_war()
+ },
+ discard() {
+ let c = game.what.shift()
+ log(`Discarded #${c}`)
+ resume_levy_arts_of_war()
+ },
+}
+
+function end_levy_arts_of_war() {
+ game.what = -1
+ set_active_enemy()
+ if (game.active === P2)
+ goto_levy_arts_of_war()
+ else
+ goto_pay()
}
// === LEVY: MUSTER ===
@@ -1664,11 +1732,14 @@ exports.view = function(state, current) {
vassals: game.vassals,
events: game.events,
capabilities: game.capabilities,
+
conquered: game.conquered,
ravaged: game.ravaged,
- castles: game.castles,
sieges: game.sieges,
+ castles: game.castles,
+ walls: game.walls,
+
legate: game.legate,
veche_vp: game.veche_vp,
veche_coin: game.veche_coin,
diff --git a/tools/gendata.js b/tools/gendata.js
index 61980d1..53e65a7 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -630,9 +630,9 @@ arts_of_war_event("T15", "Mindaugas", "now")
arts_of_war_event("T16", "Famine", "this_campaign")
arts_of_war_event("T17", "Dietrich von Grüningen", "hold")
arts_of_war_event("T18", "Swedish Crusade", "now")
-arts_of_war_event("T0", "No Event", "now")
-arts_of_war_event("T0", "No Event", "now")
-arts_of_war_event("T0", "No Event", "now")
+arts_of_war_event("T0", "No Event", "never")
+arts_of_war_event("T0", "No Event", "never")
+arts_of_war_event("T0", "No Event", "never")
arts_of_war_capability("T1", "Treaty of Stensby", false, [ "Heinrich", "Knud & Abel" ])
arts_of_war_capability("T2", "Raiders", true, "any")
@@ -674,9 +674,9 @@ arts_of_war_event("R15", "Death of the Pope", "this_levy")
arts_of_war_event("R16", "Tempest", "now")
arts_of_war_event("R17", "Dietrich von Grüningen", "this_levy")
arts_of_war_event("R18", "Bountiful Harvest", "now")
-arts_of_war_event("R0", "No Event")
-arts_of_war_event("R0", "No Event")
-arts_of_war_event("R0", "No Event")
+arts_of_war_event("R0", "No Event", "never")
+arts_of_war_event("R0", "No Event", "never")
+arts_of_war_event("R0", "No Event", "never")
arts_of_war_capability("R1", "Luchniki", true, [ "Vladislav", "Karelians", "Gavrilo", "Domash" ])
arts_of_war_capability("R2", "Luchniki", true, [ "Vladislav", "Karelians", "Gavrilo", "Domash" ])