From 2070b30ee59e51f0b1d335f970b6cc0d3b0d6dd1 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 31 May 2024 23:36:33 +0200 Subject: dynamic stroke of fate text --- play.js | 15 +---------- rules.js | 91 +++++++++++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 71 insertions(+), 35 deletions(-) diff --git a/play.js b/play.js index 68104e0..7896724 100644 --- a/play.js +++ b/play.js @@ -298,19 +298,6 @@ const fate_effect_text = [ // "Sweden quits the game! Also, Prussia has to remove any one general (other than Friedrich) permanently from the game; this general may be off-map. If Russia has already quit the game as well, the Imperial Army switches players and eased victory conditions come into effect for Austria and the Imperial Army (see rule 11).", // "From now on Austria receives only 4 TC; France only 3 (which she may all keep). If this has already happened, then: France quits the game! Cumberland is removed permanently from the game. Hanover receives only 1 TC from now on. The Imperial Army switches players and eased victory conditions come into effect for Austria and the Imperial Army (see rule 11).", // "From now on Austria receives only 4 TC; France only 3 (which she may all keep). If this has already happened, then: France quits the game. Cumberland is removed permanently from the game. Hanover receives only 1 TC from now on. The Imperial Army switches players and eased victory conditions come into effect for Austria and the Imperial Army (see rule 11).", - - "From now on Prussia will receive two less Tactical Cards, but always a minimum of four.", - "From now on Prussia will receive two less Tactical Cards, but always a minimum of four.", - "Russia quits the game! For Sweden eased victory conditions come into effect. If Sweden has already quit the game, the Imperial Army switches players and eased victory conditions come into effect for Austria and the Imperial Army.", - "Sweden quits the game! If Russia has already quit the game as well, the Imperial Army switches players and eased victory conditions come into effect for Austria and the Imperial Army.", - "From now on Austria receives only 4 TC; France only 3 (which she may all keep). If this has already happened, then: France quits the game! Hanover receives only 1 TC from now on. The Imperial Army switches players and eased victory conditions come into effect for Austria and the Imperial Army.", - "From now on Austria receives only 4 TC; France only 3 (which she may all keep). If this has already happened, then: France quits the game! Hanover receives only 1 TC from now on. The Imperial Army switches players and eased victory conditions come into effect for Austria and the Imperial Army.", - - null, - null, - null, - null, - null, ] const the_war_in_the_west_text = `

Prussia receives 2 TC per round, but has to discard one of these two immediately. As soon as the first subsidy reduction occurs (due to the Card of Fate “Lord Bute” or “Poems”) Prussia receives only 1 TC per round. The second subsidy reduction has no effect. @@ -1159,7 +1146,7 @@ function on_log(text) { if (text.match(/^\$(\d+)/)) { let fx = parseInt(text.substring(1)) - if (fx < 48 + 6) + if (fx < 48) text = `

${fate_flavor_text[fx]}
${fate_effect_text[fx]}
` else text = `
${fate_flavor_text[fx]}
` diff --git a/rules.js b/rules.js index 956ad15..c9dd87f 100644 --- a/rules.js +++ b/rules.js @@ -2196,7 +2196,6 @@ 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("!") log(`>P${a} at S${game.attacker}`) log(`>P${d} at S${game.defender}`) @@ -3068,6 +3067,66 @@ function goto_clock_of_fate() { log("$" + game.fx) } + switch (fc) { + case FC_POEMS: + case FC_LORD_BUTE: + if (set_has(game.fate, FC_POEMS) || set_has(game.fate, FC_LORD_BUTE)) { + if (game.scenario === 1) + log("No effect.") + if (game.scenario === 2) + log("From now on Prussia will receive three Tactical Cards.") + if (game.scenario >= 3) + log("From now on Prussia will receive four Tactical Cards.") + } else { + if (game.scenario === 1) + log("From now on Prussia will receive one Tactical Card.") + if (game.scenario === 2) + log("From now on Prussia will receive four Tactical Cards.") + if (game.scenario >= 3) + log("From now on Prussia will receive five Tactical Cards.") + } + break + case FC_ELISABETH: + log("Russia quits the game!") + if (game.scenario === 1 || game.scenario === 2) + break + log_br() + log("Prussia has to remove any one general (other than Friedrich) permanently from the game; this general may be off-map.") + log_br() + if (set_has(game.fate, FC_SWEDEN)) + log("The Imperial Army switches players and eased victory conditions come into effect for Austria and the Imperial Army.") + else + log("For Sweden eased victory conditions come into effect.") + break + case FC_SWEDEN: + log("Sweden quits the game!") + if (game.scenario === 1 || game.scenario === 2) + break + log_br() + log("Prussia has to remove any one general (other than Friedrich) permanently from the game; this general may be off-map.") + if (set_has(game.fate, FC_ELISABETH)) { + log_br() + log("The Imperial Army switches players and eased victory conditions come into effect for Austria and the Imperial Army.") + } + break + case FC_AMERICA: + case FC_INDIA: + if (set_has(game.fate, FC_AMERICA) || set_has(game.fate, FC_INDIA)) { + log("France quits the game!") + if (game.scenario === 1 || game.scenario === 2) + break + log_br() + log("Cumberland is removed permanently from the game. Hanover receives only 1 TC from now on.") + log_br() + log("The Imperial Army switches players and eased victory conditions come into effect for Austria and the Imperial Army.") + } else { + if (game.scenario === 1) + break + log("From now on Austria receives only 4 TC; France only 3 (which she may all keep).") + } + break + } + set_add(game.fate, fc) if (fc === FC_POEMS && !set_has(game.fate, FC_LORD_BUTE)) @@ -3090,26 +3149,16 @@ function goto_clock_of_fate() { return } - if (fc === FC_ELISABETH) { - let n = count_captured_objectives(P_RUSSIA) - log("Russia dropped out with " + n + " objectives.") - } - - if (fc === FC_SWEDEN) { - let n = count_captured_objectives(P_SWEDEN) - log("Sweden dropped out with " + n + " objectives.") - } - - if ((fc === FC_INDIA && set_has(game.fate, FC_AMERICA)) || (fc === FC_AMERICA && set_has(game.fate, FC_INDIA))) { - let n = count_captured_objectives(P_FRANCE) - log("France dropped out with " + n + " objectives.") - } - - if (did_imperial_army_switch_players_now(fc)) { - let n = count_captured_objectives(P_IMPERIAL) - log_br() - log("Pompadour took over the Imperial Army with " + n + " objectives.") - } + /* TODO: remember score when powers drop out + if (fc === FC_ELISABETH) + game.score[P_RUSSIA] = count_captured_objectives(P_RUSSIA) + if (fc === FC_SWEDEN) + game.score[P_SWEDEN] = count_captured_objectives(P_SWEDEN) + if ((fc === FC_INDIA && set_has(game.fate, FC_AMERICA)) || (fc === FC_AMERICA && set_has(game.fate, FC_INDIA))) + game.score[P_FRANCE] = count_captured_objectives(P_FRANCE) + if (did_imperial_army_switch_players_now(fc)) + game.score[P_AUSTRIA] = count_captured_objectives(P_IMPERIAL) + */ // eased victory conditions if (has_russia_dropped_out()) { -- cgit v1.2.3