diff options
author | Joël Simoneau <simoneaujoel@gmail.com> | 2025-04-18 09:28:45 -0400 |
---|---|---|
committer | Joël Simoneau <simoneaujoel@gmail.com> | 2025-04-18 09:28:45 -0400 |
commit | 7510fae1718ca1249b3517f7452844f865fa729e (patch) | |
tree | cbb6051ac1d788ac291982da78bed01b1d9c0a43 | |
parent | 0dfadb71724d007a1345992c79caf38f87abc5f6 (diff) | |
download | vijayanagara-7510fae1718ca1249b3517f7452844f865fa729e.tar.gz |
Streamlined MI
-rw-r--r-- | rules.js | 32 |
1 files changed, 22 insertions, 10 deletions
@@ -2801,18 +2801,23 @@ states.mi_attack = { }, space(s) { - log_space(s, "Attack") game.cmd.where = s - game.cmd.attacker = MI - game.cmd.target = DS - set_add(game.cmd.spaces, s) - goto_attack_space() + if (count_faction_pieces(s, DS) > 0) { + log_space(s, "Attack") + game.cmd.attacker = MI + game.cmd.target = DS + set_add(game.cmd.spaces, s) + goto_attack_space() + } else { + goto_plunder() + } } } function goto_plunder() { - change_current(DS) if (count_pieces(game.cmd.where, MI, TROOPS) > 0) { + if (game.cmd.where != S_MOUNTAIN_PASSES) + change_current(DS) log_space(game.cmd.where, "Plunder") game.state = "plunder" } else @@ -2827,12 +2832,14 @@ states.plunder = { 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!` + if (game.active === DS) + view.prompt = `Attack & Plunder: Lose ${n} resources from the plundering Mongol Invaders!` + else + view.prompt = `Attack & Plunder: The Sultanate loses ${n} resources from the plundering Mongol Invaders!` gen_action_resources(DS) } }, resources(f) { - clear_undo() let n = Math.min(game.resources[DS] - 3, count_pieces(game.cmd.where, MI, TROOPS)) logi_resources(f, -n) add_resources(f, -n) @@ -2903,8 +2910,13 @@ function end_plunder() { log_br() log(`Returned ${n} CMI from S${game.cmd.where}.`) } - change_current(game.cmd.sa_faction) - goto_strategic_assistance() + + if (game.cmd.free === 0 && game.inf[game.cmd.sa_faction] === 0) { + game.state = "end_mongol_invasion" + } else { + change_current(game.cmd.sa_faction) + goto_strategic_assistance() + } } /* TRIBUTARY AND REBELS */ |