summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.html14
-rw-r--r--play.js22
-rw-r--r--rules.js56
3 files changed, 46 insertions, 46 deletions
diff --git a/play.html b/play.html
index 406f011..ef93af4 100644
--- a/play.html
+++ b/play.html
@@ -304,18 +304,18 @@ body.shift .mustered_vassals {
z-index: 2;
}
-#p1_capabilities, #p2_capabilities {
+#capabilities1, #capabilities2 {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
-#p1_capabilities {
+#capabilities1 {
margin-left: 24px;
justify-content: start;
}
-#p2_capabilities {
+#capabilities2 {
margin-right: 24px;
justify-content: end;
}
@@ -1098,8 +1098,8 @@ body.shift .mustered_vassals {
</div>
<div class="tuck_under_map">
-<div id="p1_capabilities"></div>
-<div id="p2_capabilities"></div>
+<div id="capabilities1"></div>
+<div id="capabilities2"></div>
</div>
<div id="events"></div>
@@ -1110,9 +1110,9 @@ body.shift .mustered_vassals {
<div id="plan_actions"></div>
</div>
-<div id="p1_court" class="court"></div>
+<div id="court1" class="court"></div>
-<div id="p2_court" class="court"></div>
+<div id="court2" class="court"></div>
<div id="hand" class="hand"></div>
diff --git a/play.js b/play.js
index d9ad807..a127b5b 100644
--- a/play.js
+++ b/play.js
@@ -215,7 +215,7 @@ function is_p2_locale(loc) {
function count_vp1() {
let vp = 0
- for (let loc of view.locales.p1_castles)
+ for (let loc of view.locales.castles1)
vp += 2
for (let loc of view.locales.conquered)
if (is_p2_locale(loc))
@@ -228,7 +228,7 @@ function count_vp1() {
function count_vp2() {
let vp = view.call_to_arms.veche_vp * 2
- for (let loc of view.locales.p2_castles)
+ for (let loc of view.locales.castles2)
vp += 2
for (let loc of view.locales.conquered)
if (is_p1_locale(loc))
@@ -370,8 +370,8 @@ const ui = {
arts_of_war_dialog: document.getElementById("arts_of_war"),
arts_of_war_list: document.getElementById("arts_of_war_list"),
events: document.getElementById("events"),
- p1_capabilities: document.getElementById("p1_capabilities"),
- p2_capabilities: document.getElementById("p2_capabilities"),
+ capabilities1: document.getElementById("capabilities1"),
+ capabilities2: document.getElementById("capabilities2"),
hand: document.getElementById("hand"),
command: document.getElementById("command"),
turn: document.getElementById("turn"),
@@ -935,12 +935,12 @@ function update_locale(loc) {
ui.locale_markers[loc].appendChild(get_cached_element(cn))
}
- if (set_has(view.locales.p1_castles, loc)) {
+ if (set_has(view.locales.castles1, loc)) {
let cn = "marker rectangle castle teutonic"
ui.locale_markers[loc].appendChild(get_cached_element(cn))
}
- if (set_has(view.locales.p2_castles, loc)) {
+ if (set_has(view.locales.castles2, loc)) {
let cn = "marker rectangle castle russian"
ui.locale_markers[loc].appendChild(get_cached_element(cn))
}
@@ -1038,16 +1038,16 @@ function update_cards() {
for (let c of view.events)
ui.events.appendChild(ui.cards[c])
- ui.p1_capabilities.replaceChildren()
+ ui.capabilities1.replaceChildren()
for_each_teutonic_card(c => {
if (view.capabilities.includes(c))
- ui.p1_capabilities.appendChild(ui.cards[c])
+ ui.capabilities1.appendChild(ui.cards[c])
})
- ui.p2_capabilities.replaceChildren()
+ ui.capabilities2.replaceChildren()
for_each_russian_card(c => {
if (view.capabilities.includes(c))
- ui.p2_capabilities.appendChild(ui.cards[c])
+ ui.capabilities2.appendChild(ui.cards[c])
})
ui.hand.replaceChildren()
@@ -1177,7 +1177,7 @@ function build_div(parent, className, id, onclick) {
}
function build_lord_mat(lord, ix, side, name) {
- let parent = document.getElementById(side === 'teutonic' ? "p1_court" : "p2_court")
+ let parent = document.getElementById(side === 'teutonic' ? "court1" : "court2")
let mat = build_div(parent, `mat ${side} ${name} hide`)
let bg = build_div(mat, "background")
ui.forces[ix] = build_div(bg, "forces")
diff --git a/rules.js b/rules.js
index 2d144b1..f35c7b4 100644
--- a/rules.js
+++ b/rules.js
@@ -580,14 +580,14 @@ function add_ravaged_marker(loc) {
function has_enemy_castle(loc) {
if (game.active === P1)
- return set_has(game.locales.p2_castles, loc)
- return set_has(game.locales.p1_castles, loc)
+ return set_has(game.locales.castles2, loc)
+ return set_has(game.locales.castles1, loc)
}
function has_friendly_castle(loc) {
if (game.active === P1)
- return set_has(game.locales.p1_castles, loc)
- return set_has(game.locales.p2_castles, loc)
+ return set_has(game.locales.castles1, loc)
+ return set_has(game.locales.castles2, loc)
}
function has_conquered_stronghold(loc) {
@@ -735,10 +735,10 @@ exports.setup = function (seed, scenario, options) {
state: "setup_lords",
stack: [],
- p1_hand: [],
- p2_hand: [],
- p1_plan: [],
- p2_plan: [],
+ hand1: [],
+ hand2: [],
+ plan1: [],
+ plan2: [],
turn: 0,
capabilities: [], // global capabilities
@@ -762,8 +762,8 @@ exports.setup = function (seed, scenario, options) {
ravaged: [],
sieges: [],
- p1_castles: [],
- p2_castles: [],
+ castles1: [],
+ castles2: [],
walls: [],
},
@@ -858,7 +858,7 @@ function setup_peipus() {
game.call_to_arms.veche_vp = 4
game.call_to_arms.veche_coin = 3
- set_add(game.locales.p2_castles, LOC_KOPORYE)
+ set_add(game.locales.castles2, LOC_KOPORYE)
set_add(game.locales.conquered, LOC_IZBORSK)
set_add(game.locales.conquered, LOC_PSKOV)
set_add(game.locales.ravaged, LOC_VOD)
@@ -890,7 +890,7 @@ function setup_return_of_the_prince() {
game.call_to_arms.veche_vp = 3
game.call_to_arms.veche_coin = 2
- set_add(game.locales.p1_castles, LOC_KOPORYE)
+ set_add(game.locales.castles1, LOC_KOPORYE)
set_add(game.locales.conquered, LOC_KAIBOLOVO)
set_add(game.locales.conquered, LOC_KOPORYE)
set_add(game.locales.conquered, LOC_IZBORSK)
@@ -923,7 +923,7 @@ function setup_return_of_the_prince_nicolle() {
game.call_to_arms.veche_vp = 3
game.call_to_arms.veche_coin = 2
- set_add(game.locales.p1_castles, LOC_KOPORYE)
+ set_add(game.locales.castles1, LOC_KOPORYE)
set_add(game.locales.conquered, LOC_KAIBOLOVO)
set_add(game.locales.conquered, LOC_KOPORYE)
set_add(game.locales.ravaged, LOC_VOD)
@@ -1008,8 +1008,8 @@ function setup_pleskau_quickstart() {
goto_campaign_plan()
- game.p1_plan = [ LORD_YAROSLAV, LORD_RUDOLF, LORD_HERMANN, LORD_HERMANN, LORD_RUDOLF, LORD_HERMANN ]
- game.p2_plan = [ LORD_GAVRILO, LORD_VLADISLAV, LORD_DOMASH, LORD_GAVRILO, LORD_DOMASH, LORD_DOMASH ]
+ game.plan1 = [ LORD_YAROSLAV, LORD_RUDOLF, LORD_HERMANN, LORD_HERMANN, LORD_RUDOLF, LORD_HERMANN ]
+ game.plan2 = [ LORD_GAVRILO, LORD_VLADISLAV, LORD_DOMASH, LORD_GAVRILO, LORD_DOMASH, LORD_DOMASH ]
// goto_command_activation()
}
@@ -1192,9 +1192,9 @@ states.levy_arts_of_war = {
let c = game.what.shift()
log(`Held event card.`)
if (game.active === P1)
- game.p1_hand.push(c)
+ game.hand1.push(c)
else
- game.p2_hand.push(c)
+ game.hand2.push(c)
resume_levy_arts_of_war()
},
discard() {
@@ -1553,8 +1553,8 @@ function goto_campaign_plan() {
set_active(BOTH)
game.state = "campaign_plan"
- game.p1_plan = []
- game.p2_plan = []
+ game.plan1 = []
+ game.plan2 = []
}
function plan_has_lieutenant(first, last) {
@@ -1589,7 +1589,7 @@ function plan_can_make_lieutenant(plan, upper, first, last) {
states.campaign_plan = {
prompt(current) {
- let plan = current === P1 ? game.p1_plan : game.p2_plan
+ let plan = current === P1 ? game.plan1 : game.plan2
let first = current === P1 ? first_p1_lord : first_p2_lord
let last = current === P1 ? last_p1_lord : last_p2_lord
let upper = plan_selected_lieutenant(first, last)
@@ -1645,11 +1645,11 @@ states.campaign_plan = {
set_lower_lord(upper, lord)
},
plan(lord, current) {
- let plan = current === P1 ? game.p1_plan : game.p2_plan
+ let plan = current === P1 ? game.plan1 : game.plan2
plan.push(lord)
},
undo(_, current) {
- let plan = current === P1 ? game.p1_plan : game.p2_plan
+ let plan = current === P1 ? game.plan1 : game.plan2
let first = current === P1 ? first_p1_lord : first_p2_lord
let last = current === P1 ? last_p1_lord : last_p2_lord
for (let lord = first; lord <= last; ++lord)
@@ -1687,18 +1687,18 @@ function end_campaign_plan() {
// === CAMPAIGN: COMMAND ACTIVATION ===
function goto_command_activation() {
- if (game.p2_plan.length === 0) {
+ if (game.plan2.length === 0) {
game.command = NOBODY
goto_end_campaign()
return
}
- if (game.p2_plan.length > game.p1_plan.length) {
+ if (game.plan2.length > game.plan1.length) {
set_active(P2)
- game.command = game.p2_plan.shift()
+ game.command = game.plan2.shift()
} else {
set_active(P1)
- game.command = game.p1_plan.shift()
+ game.command = game.plan1.shift()
}
if (game.command === NOBODY) {
@@ -2408,9 +2408,9 @@ exports.view = function (state, current) {
}
if (current === P1)
- view.hand = game.p1_hand
+ view.hand = game.hand1
if (current === P2)
- view.hand = game.p2_hand
+ view.hand = game.hand2
if (game.state === "game_over") {
view.prompt = game.victory