diff options
author | Joël Simoneau <simoneaujoel@gmail.com> | 2025-03-25 09:34:46 -0400 |
---|---|---|
committer | Joël Simoneau <simoneaujoel@gmail.com> | 2025-03-25 09:34:46 -0400 |
commit | 193161797ccde2361cb947ca912f6045818c0be4 (patch) | |
tree | f2fc1062e5c660626d5a486ef8ab5e98ba896ded | |
parent | f9780b1b67888e4ac75305b0e33c6225788ef1c7 (diff) | |
download | vijayanagara-193161797ccde2361cb947ca912f6045818c0be4.tar.gz |
Flags as acronyms
-rw-r--r-- | play.css | 2 | ||||
-rw-r--r-- | play.js | 8 | ||||
-rw-r--r-- | rules.js | 47 |
3 files changed, 34 insertions, 23 deletions
@@ -141,6 +141,8 @@ header.your_turn.ve { background-color: #ffbf32 } #log .h2.ve { background-color: #e4ba6e } #log .h2.mi { background-color: #ebc9be } +#log img.f { height: 16px; vertical-align: -2px } + #log { font-variant-numeric: tabular-nums; } #log .italic { font-style: italic; } #log div { padding-left: 20px; text-indent: -12px; } @@ -1325,6 +1325,10 @@ function sub_space(match, p1) { return `<span class="tip" onmouseenter="on_focus_space_tip(${x})" onmouseleave="on_blur_space_tip(${x})" onmousedown="on_click_space_tip(${x})">${n}</span>` } +const F_DS = '<img class="f" src="images/Flags_DS.png">' +const F_BK = '<img class="f" src="images/Flags_BK.png">' +const F_VE = '<img class="f" src="images/Flags_VE.png">' + function on_log(text) { let p = document.createElement("div") let sub_text = "" @@ -1338,6 +1342,10 @@ function on_log(text) { text = text.replace(/</g, "<") text = text.replace(/>/g, ">") + text = text.replace(/\bFDS\b/g, F_DS) + text = text.replace(/\bFBK\b/g, F_BK) + text = text.replace(/\bFVE\b/g, F_VE) + if (text.match(/^\.h1 Mongol Invaders/)) { text = text.substring(19) p.className = "h1 mi" @@ -61,6 +61,7 @@ const last_province = S_TAMILAKAM const faction_name = [ "Delhi Sultanate", "Bahmani Kingdom", "Vijayanagara Empire", "Mongol Invaders" ] const faction_acronyms = [ "DS", "BK", "VE", "MI" ] +const faction_flags = [ "FDS", "FBK", "FVE", "FMI" ] const AD = [ "0", '\u2776', '\u2777', '\u2778', '\u2779', '\u277A', '\u277B' ] const DD = [ "0", '\u2460', '\u2461', '\u2462', '\u2463', '\u2464', '\u2465' ] @@ -1313,8 +1314,8 @@ function next_attack_cavalry_step() { game.cmd.d_hit = game.dice.slice(4).filter(d => d > 0 && d <= game.cmd.n_units[1] && d < 6).length game.cmd.victor = get_attack_victor() log_br() - log(`${faction_acronyms[game.cmd.attacker]} scores ${game.cmd.a_hit} hits.`) - log(`${faction_acronyms[game.cmd.target]} scores ${game.cmd.d_hit} hits.`) + log(`${faction_flags[game.cmd.attacker]} scores ${game.cmd.a_hit} hits.`) + log(`${faction_flags[game.cmd.target]} scores ${game.cmd.d_hit} hits.`) goto_attack_casualties() } } @@ -1332,12 +1333,12 @@ function goto_attack_cavalry(curr) { ) if (d_hit !== -1) { - log(`${faction_acronyms[curr]} is using Cavalry.`) + log(`${faction_flags[curr]} is using Cavalry.`) attack_use_cavalry(d_hit + (curr === game.cmd.attacker ? 0 : 4), MI) } else { let d_hit2 = dices.findIndex(d => d === 2) if (d_hit2 !== -1 && curr === game.cmd.attacker) { - log(`${faction_acronyms[curr]} is using Cavalry.`) + log(`${faction_flags[curr]} is using Cavalry.`) attack_use_cavalry(d_hit2 + (curr === game.cmd.attacker ? 0 : 4), MI) } } @@ -1365,7 +1366,7 @@ states.attack_cavalry = { die(d) { push_undo() if (!game.cmd.cavalry) { - log(`${faction_acronyms[game.current]} is using Cavalry.`) + log(`${faction_flags[game.current]} is using Cavalry.`) game.cmd.cavalry = true } attack_use_cavalry(d, game.current) @@ -3203,7 +3204,7 @@ function add_influence(faction) { return game.inf[faction]++ - log(faction_acronyms[faction] + " gains Influence.") + log(faction_flags[faction] + " gains Influence.") update_vp() if (faction === BK && game.inf[faction] === 2) @@ -3219,7 +3220,7 @@ function remove_influence(faction) { end_influence() } else { game.inf[faction]-- - log(faction_acronyms[faction] + " loses Influence.") + log(faction_flags[faction] + " loses Influence.") update_vp() if (faction === BK && game.inf[faction] === 3) @@ -3802,27 +3803,27 @@ function log_summary_remove(p) { function log_summary_cavalry(c) { let from = game.cavalry[c] if (from !== AVAILABLE) - log_summary(faction_acronyms[game.current] + " Cavalry +% from " + faction_acronyms[from] + ".") + log_summary(faction_flags[game.current] + " +% Cavalry from " + faction_flags[from] + ".") else - log_summary(faction_acronyms[game.current] + " Cavalry +% from supply.") + log_summary(faction_flags[game.current] + " +% Cavalry from supply.") } function log_summary_resources(faction) { - log_summary(faction_acronyms[faction] + " Resources +%.") + log_summary(faction_flags[faction] + " +% Resources.") } function logi_resources(faction, n) { if (n > 0) - logi(faction_acronyms[faction] + " Resources +" + n) + logi(faction_flags[faction] + " +" + n + " Resources.") else - logi(faction_acronyms[faction] + " Resources " + n) + logi(faction_flags[faction] + " " + n + " Resources." ) } function log_resources(faction, n) { if (n > 0) - log(faction_acronyms[faction] + " Resources +" + n + ".") + log(faction_flags[faction] + " +" + n + " Resources.") else - log(faction_acronyms[faction] + " Resources " + n + ".") + log(faction_flags[faction] + " " + n + " Resources.") } function format_unit_count(faction, type, n) { @@ -4254,7 +4255,7 @@ function goto_gk_event(shaded) { if (shaded) { log_h2(faction_name[game.current] + " - Shaded Event") - log(faction_acronyms[game.current] + " is using the set-aside Event Card.") + log(faction_flags[game.current] + " is using the set-aside Event Card.") log_br() log("C" + c) log(".i " + data.card_flavor_shaded[c] + ".") @@ -4262,7 +4263,7 @@ function goto_gk_event(shaded) { goto_vm(c * 2 + 1) } else { log_h2(faction_name[game.current] + " - Event") - log(faction_acronyms[game.current] + " is using the set-aside Event Card.") + log(faction_flags[game.current] + " is using the set-aside Event Card.") log_br() log("C" + c) if (data.card_flavor[c]) @@ -4476,7 +4477,7 @@ function vm_log_br() { } function vm_log_h2() { - log_h2(faction_acronyms[vm_operand(1)] + " " + vm_operand(2)) + log_h2(faction_flags[vm_operand(1)] + " " + vm_operand(2)) vm_next() } @@ -4639,7 +4640,7 @@ function vm_set_space() { } function vm_stay_eligible() { - log(faction_acronyms[game.current] + " stays Eligible.") + log(faction_flags[game.current] + " stays Eligible.") log_br() game.marked |= (16 << game.current) vm_next() @@ -4937,7 +4938,7 @@ function vm_spend_cavalry() { for (let i = 0; i < n; ++i) { game.cavalry[find_cavalry(game.current)] = AVAILABLE } - log(`${faction_acronyms[game.current]} spends ${n} Cavalry token.`) + log(`${faction_flags[game.current]} spends ${n} Cavalry token.`) vm_next() } @@ -5017,7 +5018,7 @@ states.vm_steal = { let n = Math.min(vm_operand(3), game.resources[f]) add_resources(game.current, n) add_resources(f, -n) - log(`${faction_acronyms[game.current]} steals ${n} Resources from ${faction_acronyms[f]}.`) + log(`${faction_flags[game.current]} steals ${n} Resources from ${faction_flags[f]}.`) vm_next() }, skip() { @@ -5396,9 +5397,9 @@ function vm_end_game() { let vp = Math.max(3 - count_pieces(S_DELHI, MI, TROOPS), -3) log_action("Invasion's aftermath...") if (vp > 0) - logi(faction_acronyms[DS] + " VP +" + vp + ".") + logi(faction_flags[DS] + " VP +" + vp + ".") else - logi(faction_acronyms[DS] + " VP " + vp + ".") + logi(faction_flags[DS] + " VP " + vp + ".") game.vp[DS] += vp log_h2("Victory Phase") @@ -5598,7 +5599,7 @@ states.event_25 = { function vm_event_26() { game.of_gods_and_kings[1] = game.current game.state = "event_26" - log(faction_acronyms[game.current] + " draws C" + game.of_gods_and_kings[0]) + log(faction_flags[game.current] + " draws C" + game.of_gods_and_kings[0]) vm_next() } |