diff options
author | Joël Simoneau <simoneaujoel@gmail.com> | 2025-01-14 14:51:23 -0500 |
---|---|---|
committer | Joël Simoneau <simoneaujoel@gmail.com> | 2025-01-14 14:51:23 -0500 |
commit | 33d213ce1547fa295854ade306e71b91c46460e9 (patch) | |
tree | 7709fc267354a4934424e5aa2c2540ad3f3402a5 /rules.js | |
parent | 0cc290407e8792ee79c918d528e500237173da97 (diff) | |
download | vijayanagara-33d213ce1547fa295854ade306e71b91c46460e9.tar.gz |
Migrate.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 35 |
1 files changed, 33 insertions, 2 deletions
@@ -1240,7 +1240,6 @@ function goto_attack_resolution() { if (is_rebel_faction(game.cmd.target) && is_rebel_faction(game.cmd.attacker)) console.log("Implement shift") game.state = "attack" - } @@ -1452,6 +1451,7 @@ function can_migrate_in_space(s) { function goto_migrate() { init_command("Migrate") game.cmd.pieces = [] + game.cmd.shift = false game.state = "migrate" } @@ -1462,7 +1462,6 @@ function goto_migrate_space() { } states.migrate = { - // TODO: Check Rebel status after migration prompt() { view.prompt = "Migrate: Select a Province as the Migrate destination." @@ -1474,6 +1473,7 @@ states.migrate = { view.actions.end_migrate = prompt_end_cmd(1) }, space(s) { + push_undo() game.cmd.where = s select_cmd_space(s, 1) goto_migrate_space() @@ -1503,11 +1503,42 @@ states.migrate_space = { log_summary_move_from(p) set_add(game.cmd.pieces, p) place_piece(p, game.cmd.where) + if (is_tributary(game.cmd.where)) + to_obedient(p) game.cmd.count += 1 }, next() { log_space(game.cmd.where, "Migrate") pop_summary() + let f = (game.current === BK) ? VE : BK + if (!game.cmd.shift && has_piece_faction(game.cmd.where, f)) { + game.state = "migrate_shift_influence" + } else { + game.state = "migrate" + } + } +} + +states.migrate_shift_influence = { + prompt() { + view.prompt = "Migrate: Pay one resource to Shift Influence." + + gen_action_resources(game.current) + + view.actions.skip = 1 + }, + resources() { + let f = (game.current === BK) ? VE : BK + add_resources(game.current, -1) + add_influence(game.current) + game.cmd.shift = true + game.inf_shift = { + "next": "migrate", + } + remove_influence(f) + }, + skip() { + game.cmd.shift = true game.state = "migrate" } } |