summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-05-13 22:12:08 +0200
committerTor Andersson <tor@ccxvii.net>2023-05-24 21:06:18 +0200
commit3de12fe760ce99a27ed0dcdb87308c0bb4d04522 (patch)
treebd4850ba2e05af5046106f649d28a08cbcf7da2b
parentba8566d0835e75f589342cee2bb39015d714d838 (diff)
downloadred-flag-over-paris-3de12fe760ce99a27ed0dcdb87308c0bb4d04522.tar.gz
Lots of logging!
-rw-r--r--events.txt1
-rw-r--r--play.html21
-rw-r--r--play.js40
-rw-r--r--rules.js139
-rw-r--r--space_forts.svg3
-rw-r--r--space_institutional.svg3
-rw-r--r--space_paris.svg3
-rw-r--r--space_public_opinion.svg3
8 files changed, 136 insertions, 77 deletions
diff --git a/events.txt b/events.txt
index f2e9e3a..d1c42c2 100644
--- a/events.txt
+++ b/events.txt
@@ -226,6 +226,7 @@ CARD 38 - Victor Hugo
CARD 39 - Léon Gambetta
# must have initiative
+ prompt "Replace up to 1 in Institutional."
replace_up_to 1 INSTITUTIONAL
if (game.active === COMMUNE)
decrease_prussian_collaboration
diff --git a/play.html b/play.html
index d2975c9..c34c5e3 100644
--- a/play.html
+++ b/play.html
@@ -23,24 +23,25 @@ body.Versailles header.your_turn { background-color: skyblue; }
#log { background-color: ivory; }
#log .h1 { background-color: hsl(40, 50%, 67%); font-weight: bold; padding-top:2px; padding-bottom:2px; text-align: center; }
#log .h2 { background-color: hsl(40, 50%, 77%); padding-top:2px; padding-bottom:2px; text-align: center; }
-#log .h3 { background-color: hsl(40, 50%, 87%); text-align: center; }
+#log .h3 { text-decoration: underline }
#log .commune { background-color: lightpink }
#log .versailles { background-color: lightblue }
#log > .i { padding-left: 20px; }
#log .tip { font-style: italic }
#log .tip:hover { cursor: pointer; text-decoration: underline; }
+#log div { padding-left: 20px; text-indent: -12px; }
+#log div.i { padding-left: 32px; text-indent: -12px; }
+
#log img.c { height: 15px; vertical-align: -3px }
#log img.d { height: 15px; vertical-align: -3px }
-#log img.m { height: 18px; vertical-align: -5px }
-
-#log .hr {
- background-color: hsl(40, 50%, 40%);
- margin: 9px 0;
- padding: 0;
- height: 1px;
- min-height: 0;
-}
+#log img.m { height: 17px; vertical-align: -5px }
+#log img.s { height: 16px; vertical-align: -4px }
+
+#log span.institutional { font-weight: bold; color: #793 }
+#log span.public_opinion { font-weight: bold; color: #d82 }
+#log span.forts { font-weight: bold; color: #577 }
+#log span.paris { font-weight: bold; color: #757 }
.role_extra {
float: right;
diff --git a/play.js b/play.js
index 2e61505..e2bf241 100644
--- a/play.js
+++ b/play.js
@@ -343,6 +343,37 @@ function sub_card_name(match, p1, offset, string) {
function sub_space_name(match, p1, offset, string) {
let c = p1 | 0
let n = space_names[c]
+ if (true) {
+ if (c <= 2)
+ return '<span class="institutional">' + n + "</span>"
+ if (c <= 5)
+ return '<span class="public_opinion">' + n + "</span>"
+ if (c <= 8)
+ return '<span class="forts">' + n + "</span>"
+ if (c <= 11)
+ return '<span class="paris">' + n + "</span>"
+ }
+
+ if (true) {
+ if (c <= 2)
+ return '<img class="s" src="space_institutional.svg">' + n
+ if (c <= 5)
+ return '<img class="s" src="space_public_opinion.svg">' + n
+ if (c <= 8)
+ return '<img class="s" src="space_forts.svg">' + n
+ if (c <= 11)
+ return '<img class="s" src="space_paris.svg">' + n
+ }
+ if (true) {
+ if (c <= 2)
+ return '<span class="institutional"><img class="s" src="space_institutional.svg">' + n + "</span>"
+ if (c <= 5)
+ return '<span class="public_opinion"><img class="s" src="space_public_opinion.svg">' + n + "</span>"
+ if (c <= 8)
+ return '<span class="forts"><img class="s" src="space_forts.svg">' + n + "</span>"
+ if (c <= 11)
+ return '<span class="paris"><img class="s" src="space_paris.svg">' + n + "</span>"
+ }
return n
}
@@ -352,6 +383,8 @@ const IMG_RD = '<img class="d" src="pieces/red_disc.svg">'
const IMG_BD = '<img class="d" src="pieces/blue_disc.svg">'
const IMG_RM = '<img class="m" src="pieces/red_cylinder.svg">'
const IMG_BM = '<img class="m" src="pieces/blue_cylinder.svg">'
+const IMG_MV = '<img class="m" src="pieces/purple_cylinder.svg">'
+const IMG_PV = '<img class="m" src="pieces/orange_cylinder.svg">'
function on_log(text) {
let p = document.createElement("div")
@@ -373,6 +406,8 @@ function on_log(text) {
text = text.replace(/\bBD\b/g, IMG_BD)
text = text.replace(/\bRM\b/g, IMG_RM)
text = text.replace(/\bBM\b/g, IMG_BM)
+ // text = text.replace(/\bMilitary VP\b/g, IMG_MV)
+ // text = text.replace(/\bPolitical VP\b/g, IMG_PV)
if (text.match(/^\.h1/)) {
text = text.substring(4)
@@ -394,11 +429,6 @@ function on_log(text) {
p.className = 'h3'
}
- if (text.match(/^\.h4/)) {
- text = text.substring(4)
- p.className = 'h4'
- }
-
if (text.match(/^.hr$/)) {
p.className = "hr";
text = "";
diff --git a/rules.js b/rules.js
index fa55b52..dba7cbb 100644
--- a/rules.js
+++ b/rules.js
@@ -346,10 +346,16 @@ function recycle_card(c) {
function add_political_vp(side, amount) {
if (side === COMMUNE) {
- logi("Commune +" + amount + " Political VP.")
+ if (amount > 0)
+ log("Commune +" + amount + " Political VP.")
+ else
+ log("Commune " + amount + " Political VP.")
game.political_vp += amount
} else {
- logi("Versailles +" + amount + " Political VP.")
+ if (amount > 0)
+ log("Versailles +" + amount + " Political VP.")
+ else
+ log("Versailles " + amount + " Political VP.")
game.political_vp -= amount
}
game.political_vp = Math.min(5, Math.max(-5, game.political_vp))
@@ -357,10 +363,16 @@ function add_political_vp(side, amount) {
function add_military_vp(side, amount) {
if (side === COMMUNE) {
- logi("Commune +" + amount + " Military VP.")
+ if (amount > 0)
+ log("Commune +" + amount + " Military VP.")
+ else
+ log("Commune " + amount + " Military VP.")
game.military_vp += amount
} else {
- logi("Versailles +" + amount + " Military VP.")
+ if (amount > 0)
+ log("Versailles +" + amount + " Military VP.")
+ else
+ log("Versailles " + amount + " Military VP.")
game.military_vp -= amount
}
game.military_vp = Math.min(5, Math.max(-5, game.military_vp))
@@ -971,7 +983,6 @@ function end_choose_objective_card() {
// === INITIATIVE PHASE ===
function goto_initiative_phase() {
- log_h2("Initiative Phase")
let c_level = commune_political_vp() - game.red_momentum
let v_level = versailles_political_vp() - game.blue_momentum
if (c_level >= v_level)
@@ -989,12 +1000,12 @@ states.initiative_phase = {
view.actions.versailles = 1
},
commune() {
- log("Initiative: Commune.")
+ log("Initiative to Commune.")
game.initiative = COMMUNE
end_initiative_phase()
},
versailles() {
- log("Initiative: Versailles.")
+ log("Initiative to Versailles.")
game.initiative = VERSAILLES
end_initiative_phase()
},
@@ -1045,7 +1056,6 @@ function resume_strategy_phase() {
if (game.red_hand.length === 1 && game.blue_hand.length === 1) {
goto_set_aside_cards()
} else {
- log_sep()
clear_undo()
game.active = enemy_player()
game.state = "strategy_phase"
@@ -1111,28 +1121,28 @@ states.play_card = {
},
event() {
push_undo()
- log_h4(game.active + " - Event")
+ log_h3(game.active + " - Event")
logi("C" + game.what)
discard_card(game.what)
goto_play_event(game.what)
},
political() {
push_undo()
- log_h4(game.active + " - Operations")
+ log_h3(game.active + " - Operations")
logi("C" + game.what)
discard_card(game.what)
goto_operations(card_ops[game.what], POLITICAL)
},
military() {
push_undo()
- log_h4(game.active + " - Operations")
+ log_h3(game.active + " - Operations")
logi("C" + game.what)
discard_card(game.what)
goto_operations(card_ops[game.what], MILITARY)
},
momentum() {
push_undo()
- log_h4(game.active + " - Momentum")
+ log_h3(game.active + " - Momentum")
logi("C" + game.what)
if (game.censorship)
recycle_card(game.what)
@@ -1176,7 +1186,7 @@ states.play_discard = {
},
card(c) {
push_undo()
- log_h4(game.active + " - Discarded Event")
+ log_h3(game.active + " - Discarded Event")
logi("C" + c)
logi("C" + game.what)
discard_card(c)
@@ -1193,7 +1203,7 @@ states.play_final_discard = {
},
card(c) {
push_undo()
- log_h4(game.active + " - Final Crisis")
+ log_h3(game.active + " - Final Crisis")
logi("C" + c)
logi("C" + game.what)
discard_final()
@@ -1211,12 +1221,10 @@ states.play_final_ops = {
},
political() {
push_undo()
- log("4 Ops.")
goto_operations(4, POLITICAL)
},
military() {
push_undo()
- log("4 Ops.")
goto_operations(4, MILITARY)
},
}
@@ -1637,7 +1645,6 @@ function goto_set_aside_cards() {
// === PIVOTAL SPACE BONUS ACTIONS ===
function goto_pivotal_space_bonus_actions() {
- clear_undo()
log_h2("Pivotal Bonus Actions")
update_presence_and_control()
game.spaces = PIVOTAL.filter(s => is_commune_control(s) || is_versailles_control(s))
@@ -1645,6 +1652,7 @@ function goto_pivotal_space_bonus_actions() {
}
function resume_pivotal_space_bonus_actions() {
+ clear_undo()
assess_crisis_breach_all()
game.active = game.initiative
if (game.spaces.length > 0)
@@ -1665,7 +1673,6 @@ states.pivotal_space_bonus_actions = {
}
function goto_bonus_action(s) {
- log_h3("S" + s)
array_remove_item(game.spaces, s)
game.where = s
game.state = "bonus_action"
@@ -1673,6 +1680,7 @@ function goto_bonus_action(s) {
game.active = COMMUNE
else
game.active = VERSAILLES
+ log_h3(DIMENSION_NAME[s] + " - " + game.active)
}
states.bonus_action = {
@@ -1690,23 +1698,23 @@ states.bonus_action = {
},
de_escalate() {
push_undo()
- log_h4(game.active + " - De-escalated")
+ // log("De-escalated.")
game.state = "de_escalate_1"
},
spread_influence() {
push_undo()
- log_h4(game.active + " - Spread Influence")
+ // log("Spread Influence.")
game.who = -1
game.count = 2
game.state = "spread_influence"
},
turncoat() {
push_undo()
- log_h4(game.active + " - Turncoat")
+ // log("Turncoat.")
game.state = "turncoat"
},
pass() {
- log_h4(game.active + " - Passed")
+ log("Passed.")
resume_pivotal_space_bonus_actions()
},
}
@@ -1796,15 +1804,14 @@ states.turncoat = {
// === CRISIS DIMENSION SCORING ===
-function score_control(s, name, cf, vf, arg) {
- log(name + ":")
+function score_control(s, cf, vf, arg) {
if (is_political_space(s)) {
if (cf(arg)) {
add_political_vp(COMMUNE, 1)
} else if (vf(arg)) {
add_political_vp(VERSAILLES, 1)
} else {
- logi("Nobody")
+ log("Nobody.")
}
} else {
if (cf(arg)) {
@@ -1812,7 +1819,7 @@ function score_control(s, name, cf, vf, arg) {
} else if (vf(arg)) {
add_military_vp(VERSAILLES, 1)
} else {
- logi("Nobody")
+ log("Nobody.")
}
}
}
@@ -1834,13 +1841,8 @@ states.crisis_dimension_scoring = {
},
space(s) {
array_remove_item(game.spaces, s)
- score_control(
- s,
- DIMENSION_NAME[s],
- is_commune_control_dimension,
- is_versailles_control_dimension,
- DIMENSION_SPACES[s]
- )
+ log_h3(DIMENSION_NAME[s])
+ score_control(s, is_commune_control_dimension, is_versailles_control_dimension, DIMENSION_SPACES[s])
if (game.spaces.length === 0)
end_crisis_dimension_scoring()
},
@@ -1862,11 +1864,14 @@ function goto_objective_card_scoring() {
game.active = game.initiative
game.count = 3
game.state = "objective_card_scoring"
+
+ /*
log("Commune Objective:")
logi("C" + commune_objective_card())
log("Versailles Objective:")
logi("C" + versailles_objective_card())
log_br()
+ */
}
states.objective_card_scoring = {
@@ -1878,11 +1883,18 @@ states.objective_card_scoring = {
gen_action_space(versailles_objective_space())
},
space(s) {
- score_control(s, "S" + s, is_commune_control, is_versailles_control, s)
- if (s === commune_objective_space())
+ if (s === commune_objective_space()) {
+ log_h3("S" + s)
+ logi("C" + commune_objective_card())
+ score_control(s, is_commune_control, is_versailles_control, s)
game.count ^= 1
- if (s === versailles_objective_space())
+ }
+ if (s === versailles_objective_space()) {
+ log_h3("S" + s)
+ logi("C" + versailles_objective_card())
+ score_control(s, is_commune_control, is_versailles_control, s)
game.count ^= 2
+ }
if (game.count === 0)
goto_objective_card_events()
},
@@ -1891,12 +1903,14 @@ states.objective_card_scoring = {
function goto_objective_card_events() {
if (!is_commune_control(commune_objective_space())) {
log_br()
- log("Commune removed C" + commune_objective_card())
+ log_h3("Commune - Removed")
+ logi("C" + commune_objective_card())
game.red_objective = 0
}
if (!is_versailles_control(versailles_objective_space())) {
log_br()
- log("Versailles removed C" + versailles_objective_card())
+ log_h3("Versailles - Removed")
+ logi("C" + versailles_objective_card())
game.blue_objective = 0
}
resume_objective_card_events()
@@ -1933,8 +1947,7 @@ states.objective_card_events = {
game.red_objective = 0
game.red_fulfilled += 1
game.active = COMMUNE
- log_sep()
- log("Commune - Objective")
+ log_h3("Commune - Objective")
logi("C" + c)
goto_play_event(c)
}
@@ -1942,8 +1955,7 @@ states.objective_card_events = {
game.blue_objective = 0
game.blue_fulfilled += 1
game.active = VERSAILLES
- log_sep()
- log("Versailles - Objective")
+ log_h3("Versailles - Objective")
logi("C" + c)
goto_play_event(c)
}
@@ -1969,6 +1981,21 @@ function goto_final_crisis() {
game.active = "Both"
game.state = "final_crisis_discard"
+ resume_final_crisis_discard()
+}
+
+function resume_final_crisis_discard() {
+ if (game.red_hand.length > game.round && game.blue_hand.length > game.round)
+ game.active = "Both"
+ else if (game.red_hand.length > game.round)
+ game.active = COMMUNE
+ else if (game.blue_hand.length > game.round)
+ game.active = VERSAILLES
+ else {
+ clear_undo()
+ game.round = 4
+ goto_initiative_phase()
+ }
}
states.final_crisis_discard = {
@@ -1991,17 +2018,7 @@ states.final_crisis_discard = {
array_remove_item(game.red_hand, c)
if (player === VERSAILLES)
array_remove_item(game.blue_hand, c)
- if (game.red_hand.length > game.round && game.blue_hand.length > game.round)
- game.active = "Both"
- else if (game.red_hand.length > game.round)
- game.active = COMMUNE
- else if (game.blue_hand.length > game.round)
- game.active = VERSAILLES
- else {
- clear_undo()
- game.round = 4
- goto_initiative_phase()
- }
+ resume_final_crisis_discard()
},
}
@@ -2029,7 +2046,6 @@ states.final_crisis_events = {
},
card(c) {
game.final_active = game.active
- log_h2(game.active)
discard_card(c)
if (game.active === VERSAILLES && is_commune_card(c)) {
game.what = c
@@ -2042,7 +2058,8 @@ states.final_crisis_events = {
game.state = "final_crisis_opponent_event"
}
else {
- log("Played C" + c + ".")
+ log_h3(game.active + " - Event")
+ logi("C" + c)
goto_play_event(c)
}
},
@@ -2057,10 +2074,13 @@ states.final_crisis_opponent_event = {
view.actions.pass = 1
},
event() {
- log("Played C" + game.what + ".")
+ log_h3(game.active + " - Event")
+ logi("C" + game.what)
goto_play_event(game.what)
},
pass() {
+ log_h3(game.active + " - Pass")
+ logi("C" + game.what)
end_card_play()
},
}
@@ -3205,12 +3225,6 @@ function log_h2(msg) {
function log_h3(msg) {
log_br()
log(".h3 " + msg)
- log_br()
-}
-
-function log_h4(msg) {
- log_br()
- log(".h4 " + msg)
}
function log_sep() {
@@ -3598,6 +3612,7 @@ CODE[38] = [ // Victor Hugo
]
CODE[39] = [ // Léon Gambetta
+ [ vm_prompt, "Replace up to 1 in Institutional." ],
[ vm_replace_up_to, 1, INSTITUTIONAL ],
[ vm_if, ()=>(game.active === COMMUNE) ],
[ vm_decrease_prussian_collaboration ],
diff --git a/space_forts.svg b/space_forts.svg
new file mode 100644
index 0000000..11f32e8
--- /dev/null
+++ b/space_forts.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+<circle fill="#577" cx="8" cy="8" r="6"/>
+</svg>
diff --git a/space_institutional.svg b/space_institutional.svg
new file mode 100644
index 0000000..3255365
--- /dev/null
+++ b/space_institutional.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+<rect fill="#793" x="2" y="2" width="12" height="12"/>
+</svg>
diff --git a/space_paris.svg b/space_paris.svg
new file mode 100644
index 0000000..a881efd
--- /dev/null
+++ b/space_paris.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+<path fill="#757" d="M 8 2 L 14 8 8 14 2 8 z"/>
+</svg>
diff --git a/space_public_opinion.svg b/space_public_opinion.svg
new file mode 100644
index 0000000..a3d6cca
--- /dev/null
+++ b/space_public_opinion.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+<path fill="#d82" d="M 8 3 L 15 13 1 13 z"/>
+</svg>