summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-30 00:26:04 +0200
committerTor Andersson <tor@ccxvii.net>2024-05-30 21:59:25 +0200
commit84e488f8b16b9dfa2a29076369a223a956f0f8ad (patch)
tree7dd89f64673fef1f63c93291cc96bfce138a887c
parent71de294622cdb63f215d85746931a9fc3b02931b (diff)
downloadfriedrich-84e488f8b16b9dfa2a29076369a223a956f0f8ad.tar.gz
log "Combat". show objective total for 2p scenarios.
-rw-r--r--play.css2
-rw-r--r--play.js17
-rw-r--r--rules.js2
3 files changed, 19 insertions, 2 deletions
diff --git a/play.css b/play.css
index 6d922bc..07524c4 100644
--- a/play.css
+++ b/play.css
@@ -138,6 +138,8 @@ body {
#log .h.fate::before { content: "\2014 " }
#log .h.fate::after { content: " \2014" }
+#log .combat { background-color: #d7cfb8; }
+
#log .h.prussia { background-color: var(--color-light-prussia); }
#log .h.hanover { background-color: var(--color-light-hanover); }
#log .h.russia { background-color: var(--color-light-russia); }
diff --git a/play.js b/play.js
index e2de08e..4f46fbb 100644
--- a/play.js
+++ b/play.js
@@ -142,16 +142,26 @@ function has_eased_victory(power) {
return false
}
+function is_war_in_the_west() {
+ return !roles["Elisabeth"] && !roles["Maria Theresa"]
+}
+
+function is_4p_scenario() {
+ return !!roles["Frederick"] && !!roles["Elisabeth"] && !!roles["Maria Theresa"]
+}
+
function count_total_objectives(pow) {
let n = objective1[pow].length
if (!has_eased_victory(pow))
n += objective2[pow].length
- if (pow === P_PRUSSIA) {
+ if (pow === P_PRUSSIA && is_4p_scenario()) {
if (view.oo === 0)
n = 0
if (view.oo < 0 && set_has(view.fate, FC_POEMS) && set_has(view.fate, FC_LORD_BUTE))
n = 0
}
+ if (pow === P_PRUSSIA && is_war_in_the_west())
+ n = 0
if (pow === P_AUSTRIA && view.oo)
n -= 4
return n
@@ -1141,6 +1151,11 @@ function on_log(text) {
p.className = "i"
}
+ if (text.match(/^!/)) {
+ text = "Combat"
+ p.className = "combat"
+ }
+
text = text.replace(/&/g, "&amp;")
text = text.replace(/</g, "&lt;")
text = text.replace(/>/g, "&gt;")
diff --git a/rules.js b/rules.js
index 1b5239e..d14b7bd 100644
--- a/rules.js
+++ b/rules.js
@@ -2188,7 +2188,7 @@ function goto_resolve_combat() {
let a = get_supreme_commander(game.attacker)
let d = get_supreme_commander(game.defender)
//log(`P${a} at S${game.attacker} with ${a_troops} troops attacked P${d} at S${game.defender} with ${d_troops} troops at ${signed_number(game.count)}.`)
- log("Combat")
+ log("!")
log(`>P${a} at S${game.attacker}`)
log(`>P${d} at S${game.defender}`)
log(`>Troops ${a_troops} - ${d_troops} = ${game.count}`)