diff options
-rw-r--r-- | play.js | 4 | ||||
-rw-r--r-- | rules.js | 34 |
2 files changed, 25 insertions, 13 deletions
@@ -76,10 +76,10 @@ const LAYOUT = { "Delhi BK": [571, 422], "Delhi VE": [724, 414], "Delhi mongols": [573, 324], - "Mountain Passes DS": [404, 106], + "Mountain Passes DS": [263, 183], "Mountain Passes BK": [236, 110], "Mountain Passes VE": [318, 105], - "Mountain Passes mongols": [263, 183], + "Mountain Passes mongols": [404, 127], "Punjab DS": [515, 164], "Punjab BK": [279, 262], "Punjab VE": [477, 266], @@ -1503,7 +1503,7 @@ states.attack_casualties = { function end_attack_casualties() { if (game.summary) - upop_summary() + upop_summary("No casualty.") clear_undo() if (game.cmd.step === 2) { game.cmd.step += 1 @@ -1518,8 +1518,7 @@ function goto_attack_resolution() { if (is_rebel_faction(game.cmd.target) && is_rebel_faction(game.cmd.attacker)) attack_influence_shift() else if (game.cmd.attacker === MI && !is_timurid()) { - change_current(game.cmd.sa_faction) - game.state = "plunder" + goto_plunder() } else if (game.vm) { vm_next() } else { @@ -2754,22 +2753,35 @@ states.mi_attack = { } } +function goto_plunder() { + change_current(DS) + if (count_pieces(game.cmd.where, MI, TROOPS) > 0) { + log_space(game.cmd.where, "Plunder") + game.state = "plunder" + } else + end_plunder() +} + states.plunder = { inactive: "Attack & Plunder", prompt() { - let n = Math.min(game.resources[DS] - 3, count_pieces(game.cmd.where, MI, TROOPS)) - view.prompt = `Attack & Plunder: Plunder ${n} resources from the Delhi Sultanate!` - gen_action_resources(DS) + if (game.resources[DS] <= 3) { + view.prompt = "Attack & Plunder: Plunder cannot reduce Delhi Sultanate resources under 3." + view.actions.next = 1 + } else { + let n = Math.min(game.resources[DS] - 3, count_pieces(game.cmd.where, MI, TROOPS)) + view.prompt = `Attack & Plunder: Lose ${n} resources from the plundering Mongol Invaders!` + gen_action_resources(DS) + } }, resources(f) { clear_undo() - log_space(game.cmd.where, "Plunder") - let n = Math.min(game.resources[DS] - 3, count_pieces(game.cmd.where, MI, TROOPS)) logi_resources(f, -n) add_resources(f, -n) goto_plunder_remove() - } + }, + next: goto_plunder_remove } function goto_plunder_remove() { @@ -3919,13 +3931,13 @@ function pop_summary() { game.summary = null } -function upop_summary() { +function upop_summary(msg="Nothing") { if (game.summary.length > 0) { for (let [n, msg] of game.summary) { log(msg.replace("%", String(n))) } } else { - log("Nothing") + log(msg) } game.summary = null } |