diff options
author | Tor Andersson <tor@ccxvii.net> | 2025-03-19 21:25:52 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2025-03-19 21:27:47 +0100 |
commit | 19d48663a25cf6f9a93e8710f6896a2b43971fcd (patch) | |
tree | 639a7ffec368b4fff88fad893cadca9c8b965451 | |
parent | 4909e4464acb93f675fc9c23891257665d2979a1 (diff) | |
download | land-and-freedom-19d48663a25cf6f9a93e8710f6896a2b43971fcd.tar.gz |
More tweaks.
-rw-r--r-- | data.js | 9 | ||||
-rw-r--r-- | data.ts | 9 | ||||
-rw-r--r-- | images/icons/hero_point.png | bin | 0 -> 1967 bytes | |||
-rw-r--r-- | images/icons/player_anarchist.png | bin | 1660 -> 1343 bytes | |||
-rw-r--r-- | images/icons/player_communist.png | bin | 1631 -> 1372 bytes | |||
-rw-r--r-- | images/icons/player_fascist.png | bin | 1037 -> 878 bytes | |||
-rw-r--r-- | images/icons/player_moderate.png | bin | 1451 -> 1160 bytes | |||
-rw-r--r-- | play.css | 4 | ||||
-rw-r--r-- | play.js | 9 | ||||
-rw-r--r-- | rules.js | 66 | ||||
-rw-r--r-- | rules.ts | 69 | ||||
-rw-r--r-- | types.d.ts | 1 |
12 files changed, 114 insertions, 53 deletions
@@ -1760,38 +1760,47 @@ const data = { { id: 0, name: 'Subterfuge', + tooltip: 'Add 1 player token to the Bag of Glory.' }, { id: 1, name: 'Valor', + tooltip: 'Gain 7 Hero points.' }, { id: 2, name: 'Momentum', + tooltip: 'Play another card.' }, { id: STRATEGY_MEDALLION_ID, name: 'Strategy', + tooltip: 'Add 1 extra Strength when Supporting a Front (once per turn).' }, { id: PROPAGANDA_MEDALLION_ID, name: 'Propaganda', + tooltip: '+1 card when drawing from your deck & keep +1 in hand at End of the Year.' }, { id: INTELLIGENCE_MEDALLION_ID, name: 'Intelligence', + tooltip: "Gain 2 extra Hero points form each Successful Test (even if you didn't support)." }, { id: VOLUNTEERS_MEDALLION_ID, name: 'Volunteers', + tooltip: 'Convert any number of Hero points into Strength added to any Front.' }, { id: ARCHIVES_MEDALLION_ID, name: 'Archives', + tooltip: 'Spend 1 Hero point: Remove a Blank marker from a Track (once per turn).' }, { id: ORGANIZATION_MEDALLION_ID, name: 'Organization', + tooltip: 'Spend 1 Hero point: this counts as any 1 Track icon for the Morale Bonus.' }, ], tracks: [ @@ -1832,38 +1832,47 @@ const data: StaticData = { { id: 0, name: 'Subterfuge', + tooltip: 'Add 1 player token to the Bag of Glory.' }, { id: 1, name: 'Valor', + tooltip: 'Gain 7 Hero points.' }, { id: 2, name: 'Momentum', + tooltip: 'Play another card.' }, { id: STRATEGY_MEDALLION_ID, name: 'Strategy', + tooltip: 'Add 1 extra Strength when Supporting a Front (once per turn).' }, { id: PROPAGANDA_MEDALLION_ID, name: 'Propaganda', + tooltip: '+1 card when drawing from your deck & keep +1 in hand at End of the Year.' }, { id: INTELLIGENCE_MEDALLION_ID, name: 'Intelligence', + tooltip: "Gain 2 extra Hero points form each Successful Test (even if you didn't support)." }, { id: VOLUNTEERS_MEDALLION_ID, name: 'Volunteers', + tooltip: 'Convert any number of Hero points into Strength added to any Front.' }, { id: ARCHIVES_MEDALLION_ID, name: 'Archives', + tooltip: 'Spend 1 Hero point: Remove a Blank marker from a Track (once per turn).' }, { id: ORGANIZATION_MEDALLION_ID, name: 'Organization', + tooltip: 'Spend 1 Hero point: this counts as any 1 Track icon for the Morale Bonus.' }, ], tracks: [ diff --git a/images/icons/hero_point.png b/images/icons/hero_point.png Binary files differnew file mode 100644 index 0000000..c922ff6 --- /dev/null +++ b/images/icons/hero_point.png diff --git a/images/icons/player_anarchist.png b/images/icons/player_anarchist.png Binary files differindex 841bf95..132aae4 100644 --- a/images/icons/player_anarchist.png +++ b/images/icons/player_anarchist.png diff --git a/images/icons/player_communist.png b/images/icons/player_communist.png Binary files differindex 20bcbfb..e5a46f5 100644 --- a/images/icons/player_communist.png +++ b/images/icons/player_communist.png diff --git a/images/icons/player_fascist.png b/images/icons/player_fascist.png Binary files differindex 5addf45..67f8d37 100644 --- a/images/icons/player_fascist.png +++ b/images/icons/player_fascist.png diff --git a/images/icons/player_moderate.png b/images/icons/player_moderate.png Binary files differindex bac73ac..988e61a 100644 --- a/images/icons/player_moderate.png +++ b/images/icons/player_moderate.png @@ -14,8 +14,6 @@ body header.fascist.your_turn { background-color: hsl(30, 35%, 65%); } #log div.h.m { background-color: hsl(325, 30%, 75%); } #log div.h.f { background-color: hsl(30, 35%, 75%); } -#log img { height: 16px; vertical-align: -4px; border: 1px solid #444; } - .panel { background-image: url(images/texture.png) } .panel { background-color: hsl(0, 0%, 60%); } .panel.anarchist { background-color: hsl(257, 10%, 60%); } @@ -64,6 +62,8 @@ body header.fascist.your_turn { background-color: hsl(30, 35%, 65%); } #log div.i { padding-left: 32px; text-indent: -12px; } #log div.ii { padding-left: 44px; text-indent: -12px; } +#log img { height: 14px; vertical-align: -3px; border: 1px solid #444; } + #log .tip { cursor: pointer; } #log .tip:hover { text-decoration: underline; } @@ -605,7 +605,7 @@ function sub_card(_match, p1) { } function sub_medallion(_match, p1) { - return `<span class="tip" onmouseenter="on_focus_medallion_tip(${p1})" onmouseleave="on_blur_tip()">${data.medallions[p1].name}</span>` + return `<i class="tip" onmouseenter="on_focus_medallion_tip(${p1})" onmouseleave="on_blur_tip()">${data.medallions[p1].name}</i>` } function sub_token(match) { @@ -614,6 +614,7 @@ function sub_token(match) { case "Tc": return `<img src="images/icons/player_communist.png">` case "Tm": return `<img src="images/icons/player_moderate.png">` case "Tf": return `<img src="images/icons/player_fascist.png">` + case "HP": return `<img src="images/icons/hero_point.png">` } return match } @@ -630,6 +631,9 @@ function on_log(text) { // eslint-disable-line no-unused-vars p.className = "i" } + text = text.replace(/<-/g, "\u2190") + text = text.replace(/->/g, "\u2192") + text = text.replace(/&/g, "&") text = text.replace(/</g, "<") text = text.replace(/>/g, ">") @@ -638,6 +642,9 @@ function on_log(text) { // eslint-disable-line no-unused-vars text = text.replace(/\bC(\d+)\b/g, sub_card) text = text.replace(/\bM(\d+)\b/g, sub_medallion) text = text.replace(/\bT[acmf]\b/g, sub_token) + text = text.replace(/\bHP\b/g, "Hero points") + // text = text.replace(/\bHP\b/g, "\u272b") + // text = text.replace(/\bHP\b/g, sub_token) if (text.startsWith("#")) { p.className = "h " + text[1] @@ -733,6 +733,8 @@ states.add_glory = { if (game.turn === 4) { number++; } + log_br(); + log("Bag of Glory:"); add_glory(get_active_faction(), number); resolve_active_and_proceed(); }, @@ -1231,7 +1233,7 @@ states.end_of_year_discard = { }, }; states.hero_points = { - inactive: 'gain Hero Points', + inactive: 'gain Hero points', auto_resolve() { const { src, v } = get_active_node_args(); if (src !== 'fascist_test') { @@ -1251,18 +1253,18 @@ states.hero_points = { if (value < 0) { view.prompt = value < -1 - ? `Lose ${Math.abs(value)} Hero Points` - : 'Lose 1 Hero Point'; + ? `Lose ${Math.abs(value)} Hero points` + : 'Lose 1 Hero point'; gen_action('lose_hp'); return; } if (game.hero_points.pool > 0) { view.prompt = - value > 1 ? `Fascist Test: Gain ${value} Hero Points.` : 'Fascist Test: Gain 1 Hero Point.'; + value > 1 ? `Fascist Test: Gain ${value} Hero points.` : 'Fascist Test: Gain 1 Hero point.'; gen_action('gain_hp'); } else { - view.prompt = 'Fascist Test: No Hero Points available in pool.'; + view.prompt = 'Fascist Test: No Hero points available in pool.'; gen_action('skip'); } }, @@ -1308,8 +1310,8 @@ states.select_player_with_most_hero_points = { const { v } = get_active_node_args(); view.prompt = v < 0 - ? 'Choose player to lose Hero Points.' - : 'Choose player to gain Hero Points.'; + ? 'Choose player to lose Hero points.' + : 'Choose player to gain Hero points.'; const factions = get_factions_with_most_hero_poins(); for (let faction_id of factions) { gen_action(faction_player_map[faction_id]); @@ -1501,7 +1503,7 @@ states.peek_fascist_cards = { }, }; function resolve_spend_hp() { - log("Hero Points:"); + log("Hero points:"); insert_before_active_node(create_state_node('spend_hero_points', get_active_faction())); next(); } @@ -1669,7 +1671,7 @@ states.remove_attack_from_fronts = { gen_action_front(id); }); if (!is_front_with_attacks) { - view.prompt = 'No valid Front to choose. You must skip'; + view.prompt = 'No valid Front to remove attacks from.'; gen_action('skip'); } }, @@ -1724,7 +1726,7 @@ states.return_card = { } } if (!possible) { - view.prompt = 'No card in trash to return. You must skip'; + view.prompt = 'No card in trash to return to your hand.'; gen_action('skip'); } }, @@ -1756,7 +1758,7 @@ states.spend_hero_points = { inactive: 'spend Hero points', prompt() { const hero_points = game.hero_points[get_active_faction()]; - view.prompt = `Spend up to ${hero_points} Hero Points.`; + view.prompt = `Spend up to ${hero_points} Hero points.`; const faction = get_active_faction(); if (hero_points === 0) { return; @@ -1908,14 +1910,14 @@ function resolve_take_hero_points(faction) { resolve_active_and_proceed(); } states.take_hero_points = { - inactive: 'take Hero Points', + inactive: 'take Hero points', prompt() { gen_spend_hero_points(); const { v } = get_active_node_args(); view.prompt = v === 1 - ? 'Take a Hero Point from any player.' - : `Take ${v} Hero Points from any player.`; + ? 'Take a Hero point from any player.' + : `Take ${v} Hero points from any player.`; const active_faction = get_active_faction(); let target_exists = false; for (const faction of role_ids) { @@ -1926,7 +1928,7 @@ states.take_hero_points = { } if (!target_exists) { view.prompt = - 'Not possible to take Hero Points from another player. You must skip'; + 'No Hero points to take from another player.'; gen_action('skip'); } }, @@ -2103,10 +2105,18 @@ function setup_return_card_from_trash() { function add_glory(faction, amount) { for (let i = 0; i < amount; ++i) game.bag_of_glory.push(faction); - if (amount > 1) - logi(`Added ${amount} T${faction} to the Bag`); - else - logi(`Added T${faction} to the Bag`); + if (game.hidden_bag) { + if (amount > 1) + logi(`Added ${amount} tokens to the Bag`); + else + logi(`Added token to the Bag`); + } + else { + if (amount > 1) + logi(`Added ${amount} T${faction} to the Bag`); + else + logi(`Added T${faction} to the Bag`); + } } function check_initiative() { let initiative; @@ -2181,7 +2191,7 @@ function end_of_turn() { } } function end_of_year() { - log_header('End of Year', 't'); + log_header('End of the Year', 't'); if (game.year === 3) { const is_won = war_is_won(); if (is_won) { @@ -2299,7 +2309,7 @@ function resolve_fascist_test() { const hero_point_actions = []; log_header("C" + get_current_event_id(), 'f'); if (test_passed) { - log(front_names[front] + ' passed:'); + log(front_names[front] + ' Test successful:'); for (const faction of get_player_order()) { let hero_points_gain = game.fronts[front].contributions.includes(faction) ? 2 @@ -2317,7 +2327,7 @@ function resolve_fascist_test() { } } else { - log(front_names[front] + ' failed:'); + log(front_names[front] + ' Test failed:'); } const effect = test_passed ? test.pass : test.fail; const node = resolve_effect(effect, 'fascist_test'); @@ -2441,7 +2451,10 @@ function move_track_to(track_id, new_value) { const current_value = game.tracks[track_id]; let change = new_value - current_value; game.tracks[track_id] = new_value; - logi(`${get_track_name(track_id)} to ${new_value}`); + if (change > 0) + logi(`${get_track_name(track_id)} +${change} to ${new_value}`); + else if (change < 0) + logi(`${get_track_name(track_id)} ${change} to ${new_value}`); check_initiative(); const triggered_spaces = change > 0 ? make_list(current_value + 1, new_value).reverse() @@ -2505,7 +2518,10 @@ function update_front(front_id, change, faction_id = null) { } const value_before = game.fronts[front_id].value; game.fronts[front_id].value += change; - logi(`${front_names[front_id]} ${change > 0 ? '+' : ''}${change}`); + if (change > 0) + logi(`${front_names[front_id]} +${change}`); + else if (change < 0) + logi(`${front_names[front_id]} ${change}`); if (faction_id !== null && value_before <= 0 && game.fronts[front_id].value > 0) { @@ -2745,7 +2761,7 @@ function log_header(msg, prefix) { } function log_trigger(args) { let [track_id, space_id] = args; - log(`Trigger ${get_track_name(track_id)} #${space_id}:`); + log(`Trigger ${get_track_name(track_id)} ${space_id}:`); resolve_active_and_proceed(); } function logi(msg) { @@ -961,6 +961,8 @@ states.add_glory = { if (game.turn === 4) { number++; } + log_br(); + log("Bag of Glory:"); add_glory(get_active_faction(), number); resolve_active_and_proceed(); }, @@ -1532,7 +1534,7 @@ states.end_of_year_discard = { }; states.hero_points = { - inactive: 'gain Hero Points', + inactive: 'gain Hero points', auto_resolve() { const { src, v } = get_active_node_args(); if (src !== 'fascist_test') { @@ -1551,17 +1553,17 @@ states.hero_points = { if (value < 0) { view.prompt = value < -1 - ? `Lose ${Math.abs(value)} Hero Points` - : 'Lose 1 Hero Point'; + ? `Lose ${Math.abs(value)} Hero points` + : 'Lose 1 Hero point'; gen_action('lose_hp'); return; } if (game.hero_points.pool > 0) { view.prompt = - value > 1 ? `Fascist Test: Gain ${value} Hero Points.` : 'Fascist Test: Gain 1 Hero Point.'; + value > 1 ? `Fascist Test: Gain ${value} Hero points.` : 'Fascist Test: Gain 1 Hero point.'; gen_action('gain_hp'); } else { - view.prompt = 'Fascist Test: No Hero Points available in pool.'; + view.prompt = 'Fascist Test: No Hero points available in pool.'; gen_action('skip'); } }, @@ -1609,8 +1611,8 @@ states.select_player_with_most_hero_points = { const { v } = get_active_node_args(); view.prompt = v < 0 - ? 'Choose player to lose Hero Points.' - : 'Choose player to gain Hero Points.'; + ? 'Choose player to lose Hero points.' + : 'Choose player to gain Hero points.'; const factions = get_factions_with_most_hero_poins(); for (let faction_id of factions) { gen_action(faction_player_map[faction_id]); @@ -1833,7 +1835,7 @@ states.peek_fascist_cards = { function resolve_spend_hp() { // insert spend hero points node before current node // so it will return to current node after resolving - log("Hero Points:") + log("Hero points:") insert_before_active_node( create_state_node('spend_hero_points', get_active_faction()) ); @@ -2043,7 +2045,7 @@ states.remove_attack_from_fronts = { gen_action_front(id); }); if (!is_front_with_attacks) { - view.prompt = 'No valid Front to choose. You must skip'; + view.prompt = 'No valid Front to remove attacks from.'; gen_action('skip'); } }, @@ -2108,7 +2110,7 @@ states.return_card = { } } if (!possible) { - view.prompt = 'No card in trash to return. You must skip'; + view.prompt = 'No card in trash to return to your hand.'; gen_action('skip'); } }, @@ -2144,7 +2146,7 @@ states.spend_hero_points = { prompt() { const hero_points = game.hero_points[get_active_faction()]; - view.prompt = `Spend up to ${hero_points} Hero Points.`; + view.prompt = `Spend up to ${hero_points} Hero points.`; const faction = get_active_faction(); @@ -2334,14 +2336,14 @@ function resolve_take_hero_points(faction: FactionId) { } states.take_hero_points = { - inactive: 'take Hero Points', + inactive: 'take Hero points', prompt() { gen_spend_hero_points(); const { v } = get_active_node_args(); view.prompt = v === 1 - ? 'Take a Hero Point from any player.' - : `Take ${v} Hero Points from any player.`; + ? 'Take a Hero point from any player.' + : `Take ${v} Hero points from any player.`; const active_faction = get_active_faction(); let target_exists = false; for (const faction of role_ids) { @@ -2353,7 +2355,7 @@ states.take_hero_points = { if (!target_exists) { view.prompt = - 'Not possible to take Hero Points from another player. You must skip'; + 'No Hero points to take from another player.'; gen_action('skip'); } }, @@ -2603,10 +2605,17 @@ function add_glory( ) { for (let i = 0; i < amount; ++i) game.bag_of_glory.push(faction); - if (amount > 1) - logi(`Added ${amount} T${faction} to the Bag`); - else - logi(`Added T${faction} to the Bag`); + if (game.hidden_bag) { + if (amount > 1) + logi(`Added ${amount} tokens to the Bag`); + else + logi(`Added token to the Bag`); + } else { + if (amount > 1) + logi(`Added ${amount} T${faction} to the Bag`); + else + logi(`Added T${faction} to the Bag`); + } } function check_initiative() { @@ -2684,7 +2693,7 @@ function end_of_turn() { } function end_of_year() { - log_header('End of Year', 't'); + log_header('End of the Year', 't'); if (game.year === 3) { const is_won = war_is_won(); @@ -2853,7 +2862,7 @@ function resolve_fascist_test() { log_header("C" + get_current_event_id(), 'f'); if (test_passed) { - log(front_names[front] + ' passed:'); + log(front_names[front] + ' Test successful:'); for (const faction of get_player_order()) { let hero_points_gain = game.fronts[front].contributions.includes( @@ -2877,7 +2886,7 @@ function resolve_fascist_test() { insert_after_active_node(create_seq_node(hero_point_actions)); } } else { - log(front_names[front] + ' failed:'); + log(front_names[front] + ' Test failed:'); } const effect = test_passed ? test.pass : test.fail; @@ -3021,7 +3030,12 @@ function move_track_to(track_id: number, new_value: number) { const current_value = game.tracks[track_id]; let change = new_value - current_value; game.tracks[track_id] = new_value; - logi(`${get_track_name(track_id)} to ${new_value}`); + if (change > 0) + logi(`${get_track_name(track_id)} +${change} to ${new_value}`); + //logi(`${get_track_name(track_id)} -> to ${new_value}`); + else if (change < 0) + logi(`${get_track_name(track_id)} ${change} to ${new_value}`); + //logi(`${get_track_name(track_id)} <- to ${new_value}`); check_initiative(); @@ -3116,7 +3130,12 @@ function update_front( } const value_before = game.fronts[front_id].value; game.fronts[front_id].value += change; - logi(`${front_names[front_id]} ${change > 0 ? '+' : ''}${change}`); + + if (change > 0) + logi(`${front_names[front_id]} +${change}`) + else if (change < 0) + logi(`${front_names[front_id]} ${change}`) + if ( faction_id !== null && value_before <= 0 && @@ -3446,7 +3465,7 @@ function log_header(msg: string, prefix: string) { function log_trigger(args) { let [ track_id, space_id ] = args; - log(`Trigger ${get_track_name(track_id)} #${space_id}:`); + log(`Trigger ${get_track_name(track_id)} ${space_id}:`); resolve_active_and_proceed(); } @@ -210,6 +210,7 @@ export interface StaticData { medallions: Array<{ id: number; name: string; + tooltip: string; }>; tracks: Array<{ id: number; |