summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.css2
-rw-r--r--play.js8
-rw-r--r--rules.js47
3 files changed, 34 insertions, 23 deletions
diff --git a/play.css b/play.css
index eb31f96..dc3dcf8 100644
--- a/play.css
+++ b/play.css
@@ -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; }
diff --git a/play.js b/play.js
index 6a0fcff..2dabece 100644
--- a/play.js
+++ b/play.js
@@ -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, "&lt;")
text = text.replace(/>/g, "&gt;")
+ 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"
diff --git a/rules.js b/rules.js
index 99e7936..1441c37 100644
--- a/rules.js
+++ b/rules.js
@@ -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()
}