diff options
author | Tor Andersson <tor@ccxvii.net> | 2025-04-12 13:15:00 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2025-04-12 14:36:31 +0200 |
commit | a25b93cf1fd61c44c6608d97630b6c0e6b106372 (patch) | |
tree | 8edf6d7db9cbb0375a2fc469d591ab38d73f6938 | |
parent | 6591f70043fe9ca16d34232d0ef35f8b89c179ec (diff) | |
download | vijayanagara-a25b93cf1fd61c44c6608d97630b6c0e6b106372.tar.gz |
"Short" faction names in log. Brighter colors.
-rw-r--r-- | events.txt | 20 | ||||
-rw-r--r-- | play.css | 54 | ||||
-rw-r--r-- | play.js | 154 | ||||
-rw-r--r-- | rules.js | 156 | ||||
-rw-r--r-- | tools/gencode.js | 2 |
5 files changed, 180 insertions, 206 deletions
@@ -801,23 +801,23 @@ SUCC 0 force_current DS loge "Power struggle in Delhi." flip_dynasty - log_h2 DS "The Sultanate reimposes its dominance." + log_succ DS "The Sultanate reimposes its dominance." campaign force_current BK prompt "Gain Cavalry tokens equal to Influence and Forts." - log_h2 BK "Military labor market thrives" + log_succ BK "Military labor market thrives." gain_cavalry (game.inf[BK] + count_pieces_on_map(BK, DISC)) force_current VE prompt "Gain resources equal to Influence and Temples." - log_h2 VE "Temple towns emerge anew" + log_succ VE "Temple towns emerge anew." resources VE (game.inf[VE] + count_pieces_on_map(VE, DISC)) SUCC 2 force_current DS - log_h2 DS "Delhi monitors its interests." + log_succ DS "Delhi monitors its interests." campaign force_current BK - log_h2 BK "Ala-ud-Din Hasan Bahman Shah gathers allies and takes the Deccan throne." + log_succ BK "Ala-ud-Din Hasan Bahman Shah gathers allies and takes the Deccan throne." any_limited_command if (game.prosperity[BK] === 0) log_br @@ -826,7 +826,7 @@ SUCC 2 cav_resources (Math.min(game.prosperity[BK],3)) endif force_current VE - log_h2 VE "Sangama brothers establish an empire." + log_succ VE "Sangama brothers establish an empire." any_limited_command if (game.prosperity[VE] === 0) log_br @@ -837,18 +837,18 @@ SUCC 2 SUCC 3 force_current DS - log_h2 DS "Renewed focus on infrastructure." + log_succ DS "Renewed focus on infrastructure." influence_succession force_current BK - log_h2 BK "Trade network covers the Deccan." + log_succ BK "Trade network covers the Deccan." influence_succession force_current VE - log_h2 VE "Vast, unifying medieval metropolis." + log_succ VE "Vast, unifying medieval metropolis." influence_succession SUCC 4 force_current DS - log_h2 DS "Succession Crisis in Delhi." + log_succ DS "Succession Crisis in Delhi." timurid_crisis SUCC 5 @@ -1,12 +1,24 @@ main { background-color: #777; } -#role_Delhi_Sultanate { background-color: #89a } +/* +#role_Delhi_Sultanate { background-color: #43454b } #role_Bahmani_Kingdom { background-color: #30b58b } #role_Vijayanagara_Empire { background-color: #ffbf32 } +*/ -header.your_turn.ds { background-color: #89a } -header.your_turn.bk { background-color: #30b58b } -header.your_turn.ve { background-color: #ffbf32 } +#role_Delhi_Sultanate { background-color: hsl(75, 5%, 65%) } +#role_Bahmani_Kingdom { background-color: hsl(180, 60%, 70%) } +#role_Vijayanagara_Empire { background-color: hsl(40, 100%, 70%) } + +header.your_turn.ds { background-color: hsl(75, 5%, 70%) } +header.your_turn.bk { background-color: hsl(180, 60%, 70%) } +header.your_turn.ve { background-color: hsl(40, 100%, 70%) } + +#log { background-color: white } +#log .h2.ds { background-color: hsl(75, 5%, 85%) } +#log .h2.bk { background-color: hsl(180, 60%, 85%) } +#log .h2.ve { background-color: hsl(40, 100%, 85%) } +#log .h2.mi { background-color: pink } #role_Solo { background-image: linear-gradient(120deg, #89a, #30b58b, #ffbf32) @@ -154,18 +166,20 @@ img.f { } /* LOG */ -#log .h1 { background-color: silver; font-weight: bold; padding-top:4px; padding-bottom:4px; margin-top: 8px; margin-bottom: 4px; text-align: center; } -#log .h1 { background-image: linear-gradient(60deg, #463b17, #9c8544, #756437); text-shadow: 0 0 4px rgb(0, 0, 0); color: white; } -#log .h2 { background-color: gainsboro; padding-top:2px; padding-bottom:2px; text-align: center; } - -#log .h1.mi { background-image: linear-gradient(60deg, rgb(83, 8, 8), rgb(255, 0, 0), rgb(44, 44, 40)); text-shadow: 0 0 4px rgb(0, 0, 0); color: white; font-variant: small-caps; } -#log .h1.succ1 { background-image: linear-gradient(60deg, rgb(67, 70, 54), rgb(97, 102, 82), rgb(67, 70, 54)); text-shadow: 0 0 4px rgb(0, 0, 0); color: white; font-variant: small-caps; } -#log .h1.succ2 { background-image: linear-gradient(170deg, rgb(15, 76, 69), rgb(0, 132, 121), rgb(3, 99, 95)); text-shadow: 0 0 4px rgb(0, 0, 0); color: white; font-variant: small-caps; } -#log .h1.succ3 { background-image: linear-gradient(240deg, rgb(118, 80, 0), rgb(187, 145, 9), rgb(65, 42, 0)); text-shadow: 0 0 4px rgb(0, 0, 0); color: white; font-variant: small-caps; } -#log .h2.ds { background-color: silver } -#log .h2.bk { background-color: #85dbd2 } -#log .h2.ve { background-color: #e4ba6e } -#log .h2.mi { background-color: #ebc9be } + +#log .indent { padding-left: 24px; } +#log .italic { font-style: italic; } + +#log .h1 { font-weight: bold; font-variant: small-caps; color: white; padding-top:2px; padding-bottom:2px; text-align: center; } +#log .h1 { text-shadow: 0px 0px 8px black; } +#log .h2 { padding-top: 1px; padding-bottom: 1px; text-align: center; } +#log .h3 { text-decoration: 1px #0006 underline; } + +#log .h1 { background-image: linear-gradient(60deg, #463b17, #9c8544, #756437); } +#log .h1.mi { background-image: linear-gradient(60deg, rgb(83, 8, 8), rgb(160, 0, 0), rgb(44, 44, 40)); } +#log .h1.succ1 { background-image: linear-gradient(60deg, rgb(67, 70, 54), rgb(97, 102, 82), rgb(67, 70, 54)); } +#log .h1.succ2 { background-image: linear-gradient(170deg, rgb(15, 76, 69), rgb(0, 132, 121), rgb(3, 99, 95)); } +#log .h1.succ3 { background-image: linear-gradient(240deg, rgb(118, 80, 0), rgb(187, 145, 9), rgb(65, 42, 0)); } #log img.d { height: 15px; vertical-align: -4px; margin: 0px 1px; } #log img.c { height: 15px; vertical-align: -3px; margin: 0px 1px;} @@ -173,14 +187,6 @@ img.f { #log img.h { height: 17px; vertical-align: -2px; margin: -1px 2px; } #log img.i { height: 34px; vertical-align: -3px; margin: -10px; } -#log { font-variant-numeric: tabular-nums; } -#log .italic { font-style: italic; } -#log div { padding-left: 20px; text-indent: -12px; } -#log div.indent { padding-left: 32px; text-indent: -12px; } -#log .h1 { border-bottom: 1px solid #444; border-top: 1px solid #444; } -/* #log .h2 { border-bottom: 1px solid #444; border-top: 1px solid #444; } */ -#log .h3 { text-decoration: underline;} - #log .adice { font-size: 14px; color: #9e302f; @@ -968,6 +968,7 @@ function is_stacked() { } function update_discard() { + // TODO when rewind and needs to empty if ("discard" in view) { let stacked = is_stacked() ui.discard_pile.style.flexDirection = (stacked ? "column" : "row") @@ -1376,24 +1377,41 @@ 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 D_DS = '<img class="d" src="pieces/ds_disk.svg">' -const D_BK = '<img class="d" src="pieces/bk_disk.svg">' -const D_VE = '<img class="d" src="pieces/ve_disk.svg">' - -const E_DS = '<img class="h" src="pieces/ds_governor.svg">' -const E_BK = '<img class="h" src="pieces/bk_amir.svg">' -const E_VE = '<img class="h" src="pieces/ve_raja.svg">' - -const C_DS = '<img class="c" src="pieces/ds_troop.svg">' -const C_MI = '<img class="c" src="pieces/mongol_invader.svg">' - -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">' -const F_MI = '<img class="f" src="images/Flags_MI.png">' +const ICONS = { + DDS: '<img class="d" src="pieces/ds_disk.svg">', + DBK: '<img class="d" src="pieces/bk_disk.svg">', + DVE: '<img class="d" src="pieces/ve_disk.svg">', + EDS: '<img class="h" src="pieces/ds_governor.svg">', + EBK: '<img class="h" src="pieces/bk_amir.svg">', + EVE: '<img class="h" src="pieces/ve_raja.svg">', + CDS: '<img class="c" src="pieces/ds_troop.svg">', + CMI: '<img class="c" src="pieces/mongol_invader.svg">', + + FDS: '<img class="f" src="images/Flags_DS.png">', + FBK: '<img class="f" src="images/Flags_BK.png">', + FVE: '<img class="f" src="images/Flags_VE.png">', + FMI: '<img class="f" src="images/Flags_MI.png">', + IBK: '<img class="i" src="images/Influence_BK.png">', + IVE: '<img class="i" src="images/Influence_VE.png">', + + A1: '<span class="adice">\u2776</span>', + A2: '<span class="adice">\u2777</span>', + A3: '<span class="adice">\u2778</span>', + A4: '<span class="adice">\u2779</span>', + A5: '<span class="adice">\u277A</span>', + A6: '<span class="adice">\u277B</span>', + + D1: '<span class="ddice">\u2460</span>', + D2: '<span class="ddice">\u2461</span>', + D3: '<span class="ddice">\u2462</span>', + D4: '<span class="ddice">\u2463</span>', + D5: '<span class="ddice">\u2464</span>', + D6: '<span class="ddice">\u2465</span>', +} -const I_BK = '<img class="i" src="images/Influence_BK.png">' -const I_VE = '<img class="i" src="images/Influence_VE.png">' +function sub_icon(match) { + return ICONS[match] ?? match +} function on_prompt(text) { return text.replaceAll("a Amir", "an Amir") @@ -1402,6 +1420,7 @@ function on_prompt(text) { function on_log(text) { let p = document.createElement("div") let sub_text = "" + let ix if (text.match(/^>/)) { text = text.substring(1) @@ -1414,98 +1433,59 @@ function on_log(text) { text = text.replace(/</g, "<") text = text.replace(/>/g, ">") - text = text.replace(/\bDDS\b/g, D_DS) - text = text.replace(/\bDBK\b/g, D_BK) - text = text.replace(/\bDVE\b/g, D_VE) - text = text.replace(/\bCDS\b/g, C_DS) - text = text.replace(/\bCMI\b/g, C_MI) - text = text.replace(/\bEDS\b/g, E_DS) - text = text.replace(/\bEBK\b/g, E_BK) - text = text.replace(/\bEVE\b/g, E_VE) - text = text.replace(/\bFDS\b/g, F_DS) - text = text.replace(/\bFBK\b/g, F_BK) - text = text.replace(/\bFVE\b/g, F_VE) - text = text.replace(/\bFMI\b/g, F_MI) - text = text.replace(/\bIBK\b/g, I_BK) - text = text.replace(/\bIVE\b/g, I_VE) - - if (text.match(/^\.h1 Mongol Invaders/)) { - text = text.substring(19) - p.className = "h1 mi" - } - else if (text.match(/^\.h1 succ/)) { - sub_text = text.substring(4, 9) - text = text.substring(10) - p.className = "h1 " + sub_text - } - else if (text.match(/^\.h1/)) { + text = text.replace(/\bDDS\b/g, sub_icon) + text = text.replace(/\bDBK\b/g, sub_icon) + text = text.replace(/\bDVE\b/g, sub_icon) + text = text.replace(/\bCDS\b/g, sub_icon) + text = text.replace(/\bCMI\b/g, sub_icon) + text = text.replace(/\bEDS\b/g, sub_icon) + text = text.replace(/\bEBK\b/g, sub_icon) + text = text.replace(/\bEVE\b/g, sub_icon) + text = text.replace(/\bFDS\b/g, sub_icon) + text = text.replace(/\bFBK\b/g, sub_icon) + text = text.replace(/\bFVE\b/g, sub_icon) + text = text.replace(/\bFMI\b/g, sub_icon) + text = text.replace(/\bIBK\b/g, sub_icon) + text = text.replace(/\bIVE\b/g, sub_icon) + + text = text.replace(/\b[AD][1-6]\b/g, sub_icon) + + text = text.replace(/ - /g, " \u2013 ") + + if (text.match(/^\.h1 C/)) { text = text.substring(4) - p.className = "h1" + ix = parseInt(text.substring(1)) + if (ix >= 37 && ix <= 44) p.className = "h1 mi" + else if (ix === 45) p.className = "h1 succ1" + else if (ix === 46) p.className = "h1 succ2" + else if (ix === 47) p.className = "h1 succ3" + else if (ix >= 48 && ix <= 49) p.className = "h1 mi" + else p.className = "h1" } - else if (text.match(/^\.h2 Delhi Sultanate/)) { + else if (text.match(/^\.h2 Sultanate/)) { text = text.substring(4) p.className = "h2 ds" } - else if (text.match(/^\.h2 DS/)) { - text = text.substring(6) - p.className = "h2 ds italic" - } - else if (text.match(/^\.h2 Bahmani Kingdom/)) { + else if (text.match(/^\.h2 Bahmani/)) { text = text.substring(4) p.className = "h2 bk" } - else if (text.match(/^\.h2 BK/)) { - text = text.substring(6) - p.className = "h2 bk italic" - } - else if (text.match(/^\.h2 Vijayanagara Empire/)) { + else if (text.match(/^\.h2 Vijayanagara/)) { text = text.substring(4) p.className = "h2 ve" } - else if (text.match(/^\.h2 VE/)) { - text = text.substring(6) - p.className = "h2 ve italic" - } - else if (text.match(/^\.h2 Mongol Invaders/)) { - text = text.substring(4) - p.className = "h2 mi" - } - else if (text.match(/^\.h2 MI/)) { + else if (text.match(/^\.h2 Mongol/)) { text = text.substring(4) p.className = "h2 mi" } - else if (text.match(/^\.h2 /)) { - text = text.substring(3) - p.className = "h2" - } else if (text.match(/^\.h3/)) { text = text.substring(4) p.className = "h3" } - else if (text.match(/^\.h4/)) { - text = text.substring(4) - p.className = "h4" - } - else if (text.match(/^\.n/)) { - text = text.substring(3) - p.className = "italic" - } else if (text.match(/^\.i/)) { text = text.substring(3) - p.className = "indent italic" - } - else if (text.match(/^\.e/)) { - text = text.substring(3) p.className = "italic" } - else if (text.match(/^\.ad/)) { - text = text.substring(4) - p.className += " adice" - } - else if (text.match(/^\.dd/)) { - text = text.substring(4) - p.className += " ddice" - } text = text.replace(/C(\d+)/g, sub_card) text = text.replace(/S(\d+)/g, sub_space) @@ -60,12 +60,12 @@ const last_space = S_PUNJAB const last_province = S_TAMILAKAM const faction_name = [ "Delhi Sultanate", "Bahmani Kingdom", "Vijayanagara Empire", "Mongol Invaders" ] +const faction_short = [ "Sultanate", "Bahmani", "Vijayanagara", "Mongols" ] 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' ] - +const AD = [ "A0", "A1", "A2", "A3", "A4", "A5", "A6" ] +const DD = [ "D0", "D1", "D2", "D3", "D4", "D5", "D6" ] exports.scenarios = [ "Standard", "Solo" ] @@ -366,27 +366,23 @@ function this_card() { function next_card_back() { if (game.deck.length > 1) { - if (game.deck[1] >= 45 && game.deck[1] <= 47) + if (game.deck[1] >= 45 && game.deck[1] <= 47) return game.deck[1] - 44 } return 0 } function goto_card() { - if (this_card() >= 37 && this_card() <= 40) { - log_h1("Mongol Invaders C" + this_card()) + log_h1("C" + this_card()) + if (this_card() >= 37 && this_card() <= 40) { goto_mongol_invaders(BK) - } else if (this_card() >= 41 && this_card() <= 44) { - log_h1("Mongol Invaders C" + this_card()) + } else if (this_card() >= 41 && this_card() <= 44) { goto_mongol_invaders(VE) - } else if (this_card() >= 45 && this_card() <= 47) { - log_h1(`succ${this_card()-44} C` + this_card()) + } else if (this_card() >= 45 && this_card() <= 47) { succession() } else if (this_card() >= 48 && this_card() <= 49) { - log_h1("Mongol Invaders C" + this_card()) succession() } else { - log_h1("C" + this_card()) adjust_eligibility(DS) adjust_eligibility(BK) adjust_eligibility(VE) @@ -485,7 +481,7 @@ function goto_pass() { game.sa = 0 game.cylinder[game.current] = SOP_PASS - log_h2(faction_name[game.current] + " - Pass") + log_h2(faction_short[game.current] + " - Pass") if (game.current === DS) { log_resources(game.current, 3) add_resources(game.current, 3) @@ -794,7 +790,7 @@ states.compromising_gifts = { }, influence(f) { push_undo() - log_h2(faction_name[f] + " - Compromising Gifts") + log_h2(faction_short[f] + " - Compromising Gifts") log_resources(f, 2) add_resources(f, 2) game.inf_shift = { @@ -954,18 +950,18 @@ states.tax = { function init_command(type) { push_undo() if (game.cmd.limited) - log_h2(faction_name[game.current] + " - Limited " + type) + log_h2(faction_short[game.current] + " - Limited " + type) else - log_h2(faction_name[game.current] + " - " + type) + log_h2(faction_short[game.current] + " - " + type) game.cmd.type = type } function init_vm_command(type, free, limited) { push_undo() if (limited) - log_h2(faction_name[game.current] + " - Limited " + type) + log_h2(faction_short[game.current] + " - Limited " + type) else - log_h2(faction_name[game.current] + " - " + type) + log_h2(faction_short[game.current] + " - " + type) game.cmd = { type: type, @@ -1212,18 +1208,18 @@ function attack_use_cavalry(d, f) { function charge_die(d) { if (d < 4) { - logi(`.ad ${AD[game.dice[d]]} -> ${AD[game.dice[d]-1]} charged`) + logi(`${AD[game.dice[d]]} -> ${AD[game.dice[d]-1]} charged`) } else { - logi(`.dd ${DD[game.dice[d]]} -> ${DD[game.dice[d]-1]} charged`) + logi(`${DD[game.dice[d]]} -> ${DD[game.dice[d]-1]} charged`) } game.dice[d] -= 1 } function screen_die(d) { if (d < 4) { - logi(`.ad ${AD[game.dice[d]]} screened`) + logi(`${AD[game.dice[d]]} screened`) } else { - logi(`.dd ${DD[game.dice[d]]} screened`) + logi(`${DD[game.dice[d]]} screened`) } game.dice[d] = 0 } @@ -1366,8 +1362,8 @@ states.attack_space = { roll() { clear_undo() roll_attack() - log(">.ad " + game.dice.slice(0,4).filter(d => d > 0).map(d => AD[d]).join(" ")) - log(">.dd " + game.dice.slice(4).filter(d => d > 0).map(d => DD[d]).join(" ")) + log(">" + game.dice.slice(0,4).filter(d => d > 0).map(d => AD[d]).join(" ")) + log(">" + game.dice.slice(4).filter(d => d > 0).map(d => DD[d]).join(" ")) log_br() game.cmd.step = 0 @@ -2045,7 +2041,7 @@ function prompt_end_decree() { function init_decree(type) { if (!is_succession()) { push_undo() - log_h2(faction_name[game.current] + " - " + type) + log_h2(faction_short[game.current] + " - " + type) } game.decree = { spaces: [], @@ -2109,7 +2105,7 @@ function can_collect() { } function collect_count() { - let c = Math.floor(game.prosperity[DS]) + let c = Math.floor(game.prosperity[DS]) return Math.floor(game.prosperity[0] / 2) } @@ -2157,25 +2153,26 @@ function goto_campaign() { game.state = "campaign" } +// TODO: precompute all distances from warangal! function is_n_from_warangal(n, s) { - let queue = [[s, []]] + let queue = [ [ s, [] ] ] - while (queue.length) { - let [node, path] = queue.shift(); + while (queue.length) { + let [ node, path ] = queue.shift() - if (path.length === n) { - if (is_adjacent_to_city(C_WARANGAL, node)) + if (path.length === n) { + if (is_adjacent_to_city(C_WARANGAL, node)) return true - } else if (path.length < n) { + } else if (path.length < n) { for (let neighbor of SPACES[node].adjacent) { - // if (!set_has(path, neighbor) && !set_has(game.decree.campaign, neighbor)) { + // if (!set_has(path, neighbor) && !set_has(game.decree.campaign, neighbor)) if (!set_has(path, neighbor) && !game.decree.campaign.includes(neighbor)) { - queue.push([neighbor, [...path, neighbor]]); + queue.push([ neighbor, [ ...path, neighbor ] ]) } } } - } - return false; + } + return false } states.campaign = { @@ -3398,9 +3395,9 @@ function add_influence(faction) { if (faction === BK && game.inf[faction] === 2) move_all_faction_piece_from(BK, ELITE, S_BK_INF_2, AVAILABLE) - else if (faction === BK && game.inf[faction] === 4) + else if (faction === BK && game.inf[faction] === 4) move_all_faction_piece_from(BK, ELITE, S_BK_INF_4, AVAILABLE) - else if (faction === VE) + else if (faction === VE) move_all_faction_piece_from(VE, ELITE, S_VE_INF_1 + game.inf[faction] - 1, AVAILABLE) } @@ -3653,7 +3650,7 @@ states.give_resources = { game.transfer.count = 0 }, deny() { - log_transfer(`${faction_name[game.current]} denied request from ${faction_name[game.transfer.current]}.`) + log_transfer(`${faction_short[game.current]} denied request from ${faction_short[game.transfer.current]}.`) end_negotiation() }, done() { @@ -3768,7 +3765,7 @@ states.give_cavalry = { set_cavalry_faction(c, game.transfer.current) }, deny() { - log_transfer(`${faction_name[game.current]} denied request from ${faction_name[game.transfer.current]}.`) + log_transfer(`${faction_short[game.current]} denied request from ${faction_short[game.transfer.current]}.`) end_negotiation() }, done() { @@ -3886,11 +3883,6 @@ function log(msg) { game.log.push(msg) } -function loge(msg) { - log_br() - game.log.push(".e " + msg) -} - function logi(msg) { log(">" + msg) } @@ -3924,11 +3916,11 @@ function log_transfer(msg) { } function log_transfer_resources(from, to, n) { - log_transfer(`${faction_name[from]} gave ${n} Resources to ${faction_name[to]}.`) + log_transfer(`${faction_short[from]} gave ${n} Resources to ${faction_short[to]}.`) } function log_transfer_cavalry(from, to, n) { - log_transfer(`${faction_name[from]} gave ${n} Cavalry tokens to ${faction_name[to]}.`) + log_transfer(`${faction_short[from]} gave ${n} Cavalry tokens to ${faction_short[to]}.`) } function log_space(s, action) { @@ -4465,20 +4457,20 @@ function goto_gk_event(shaded) { game.cmd = 0 if (shaded) { - log_h2(faction_name[game.current] + " - Shaded Event") + log_h2(faction_short[game.current] + " - Shaded Event") log(faction_flags[game.current] + " used the set-aside Event Card.") log_br() - log("C" + c) - log(".i " + data.card_flavor_shaded[c] + ".") + log(".h3 C" + c) + log(">.i " + data.card_flavor_shaded[c] + ".") log_br() goto_vm(c * 2 + 1) } else { - log_h2(faction_name[game.current] + " - Event") + log_h2(faction_short[game.current] + " - Event") log(faction_flags[game.current] + " used the set-aside Event Card.") log_br() - log("C" + c) + log(".h3 C" + c) if (data.card_flavor[c]) - log(".i " + data.card_flavor[c] + ".") + log(">.i " + data.card_flavor[c] + ".") log_br() goto_vm(c * 2 + 0) } @@ -4490,16 +4482,16 @@ function goto_event(shaded) { game.cmd = 0 if (shaded) { - log_h2(faction_name[game.current] + " - Shaded Event") - log("C" + c) - log(".i " + data.card_flavor_shaded[c] + ".") + log_h2(faction_short[game.current] + " - Shaded Event") + log(".h3 C" + c) + log(">.i " + data.card_flavor_shaded[c] + ".") log_br() goto_vm(c * 2 + 1) } else { - log_h2(faction_name[game.current] + " - Event") - log("C" + c) + log_h2(faction_short[game.current] + " - Event") + log(".h3 C" + c) if (data.card_flavor[c]) - log(".i " + data.card_flavor[c] + ".") + log(">.i " + data.card_flavor[c] + ".") log_br() goto_vm(c * 2 + 0) } @@ -4592,21 +4584,21 @@ states.vm_current = { if (game.current !== DS) clear_undo() change_current(DS) - log_transfer(faction_name[game.current] + "...") + log_transfer(faction_short[game.current] + "...") vm_next() }, bk() { if (game.current !== BK) clear_undo() change_current(BK) - log_transfer(faction_name[game.current] + "...") + log_transfer(faction_short[game.current] + "...") vm_next() }, ve() { if (game.current !== VE) clear_undo() change_current(VE) - log_transfer(faction_name[game.current] + "...") + log_transfer(faction_short[game.current] + "...") vm_next() } } @@ -4676,18 +4668,14 @@ function vm_log() { vm_next() } -function vm_loge() { - loge(vm_operand(1)) - vm_next() -} - function vm_log_br() { log_br() vm_next() } -function vm_log_h2() { - log_h2(faction_acronyms[vm_operand(1)] + " " + vm_operand(2)) +function vm_log_succ() { + log_h2(faction_short[vm_operand(1)]) + log(".i " + vm_operand(2)) vm_next() } @@ -5231,7 +5219,7 @@ states.vm_steal = { let f2 = vm_operand(2) let n = Math.min(vm_operand(3), game.resources[f2]) if (n == 0) { - event_prompt(`${faction_name[f2]} has no Resource.`) + event_prompt(`${faction_name[f2]} has no Resources.`) view.actions.skip = 1 } else { event_prompt(`Steal ${n} Resources from ${faction_name[f2]}.`) @@ -5306,7 +5294,7 @@ states.vm_steal_cavalry = { let f2 = vm_operand(2) let n = Math.min(vm_operand(3), n_cavalry(f2)) if (n == 0) { - event_prompt(`${faction_name[f2]} has no Cavalry token.`) + event_prompt(`${faction_name[f2]} has no Cavalry tokens.`) view.actions.skip = 1 } else { event_prompt(`Steal ${n} Cavalry token from ${faction_name[f2]}.`) @@ -5503,7 +5491,7 @@ states.vm_flip_dynasty = { }, dynasty_card() { game.succ += 1 - logi("Dawn of the Tughlaq Dynasty, Rebel Commands are now available.") + log("Dawn of the Tughlaq Dynasty, Rebel Commands are now available.") vm_next() } } @@ -5624,7 +5612,7 @@ function vm_end_game() { log_h2("Victory Phase") for (let i = 0; i < 3; i++) { - logi(faction_name[i] + " " + game.vp[i] + " VP") + logi(faction_short[i] + " " + game.vp[i] + " VP") } let result = get_result() @@ -6949,17 +6937,17 @@ CODE[36 * 2 + 1] = [ // SUCC 0 CODE[0 * 2 + 74] = [ [ vm_force_current, DS ], - [ vm_loge, "Power struggle in Delhi." ], + [ vm_log, ".i Power struggle in Delhi." ], [ vm_flip_dynasty ], - [ vm_log_h2, DS, "The Sultanate reimposes its dominance." ], + [ vm_log_succ, DS, "The Sultanate reimposes its dominance." ], [ vm_campaign ], [ vm_force_current, BK ], [ vm_prompt, "Gain Cavalry tokens equal to Influence and Forts." ], - [ vm_log_h2, BK, "Military labor market thrives" ], + [ vm_log_succ, BK, "Military labor market thrives." ], [ vm_gain_cavalry, ()=>(game.inf[BK] + count_pieces_on_map(BK, DISC)) ], [ vm_force_current, VE ], [ vm_prompt, "Gain resources equal to Influence and Temples." ], - [ vm_log_h2, VE, "Temple towns emerge anew" ], + [ vm_log_succ, VE, "Temple towns emerge anew" ], [ vm_resources, false, VE, ()=>(game.inf[VE] + count_pieces_on_map(VE, DISC)) ], [ vm_return ], ] @@ -6967,10 +6955,10 @@ CODE[0 * 2 + 74] = [ // SUCC 2 CODE[2 * 2 + 74] = [ [ vm_force_current, DS ], - [ vm_log_h2, DS, "Delhi monitors its interests." ], + [ vm_log_succ, DS, "Delhi monitors its interests." ], [ vm_campaign ], [ vm_force_current, BK ], - [ vm_log_h2, BK, "Ala-ud-Din Hasan Bahman Shah gathers allies and takes the Deccan throne." ], + [ vm_log_succ, BK, "Ala-ud-Din Hasan Bahman Shah gathers allies and takes the Deccan throne." ], [ vm_any_limited_command ], [ vm_if, ()=>(game.prosperity[BK] === 0) ], [ vm_log_br ], @@ -6979,7 +6967,7 @@ CODE[2 * 2 + 74] = [ [ vm_cav_resources, ()=>(Math.min(game.prosperity[BK],3)) ], [ vm_endif ], [ vm_force_current, VE ], - [ vm_log_h2, VE, "Sangama brothers establish an empire." ], + [ vm_log_succ, VE, "Sangama brothers establish an empire." ], [ vm_any_limited_command ], [ vm_if, ()=>(game.prosperity[VE] === 0) ], [ vm_log_br ], @@ -6993,13 +6981,13 @@ CODE[2 * 2 + 74] = [ // SUCC 3 CODE[3 * 2 + 74] = [ [ vm_force_current, DS ], - [ vm_log_h2, DS, "Renewed focus on infrastructure." ], + [ vm_log_succ, DS, "Renewed focus on infrastructure." ], [ vm_influence_succession ], [ vm_force_current, BK ], - [ vm_log_h2, BK, "Trade network covers the Deccan." ], + [ vm_log_succ, BK, "Trade network covers the Deccan." ], [ vm_influence_succession ], [ vm_force_current, VE ], - [ vm_log_h2, VE, "Vast, unifying medieval metropolis." ], + [ vm_log_succ, VE, "Vast, unifying medieval metropolis." ], [ vm_influence_succession ], [ vm_return ], ] @@ -7007,7 +6995,7 @@ CODE[3 * 2 + 74] = [ // SUCC 4 CODE[4 * 2 + 74] = [ [ vm_force_current, DS ], - [ vm_log_h2, DS, "Succession Crisis in Delhi." ], + [ vm_log_succ, DS, "Succession Crisis in Delhi." ], [ vm_timurid_crisis ], [ vm_return ], ] diff --git a/tools/gencode.js b/tools/gencode.js index 63b5994..70ef3c2 100644 --- a/tools/gencode.js +++ b/tools/gencode.js @@ -148,7 +148,7 @@ for (let line of fs.readFileSync("events.txt", "utf-8").split("\n")) { emit([ line[0], line.slice(1).join(" ") ]) break - case "log_h2": + case "log_succ": emit([ line[0], line[1], line.slice(2).join(" ") ]) break |