summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoël Simoneau <simoneaujoel@gmail.com>2025-01-14 14:51:23 -0500
committerJoël Simoneau <simoneaujoel@gmail.com>2025-01-14 14:51:23 -0500
commit33d213ce1547fa295854ade306e71b91c46460e9 (patch)
tree7709fc267354a4934424e5aa2c2540ad3f3402a5
parent0cc290407e8792ee79c918d528e500237173da97 (diff)
downloadvijayanagara-33d213ce1547fa295854ade306e71b91c46460e9.tar.gz
Migrate.
-rw-r--r--play.js1
-rw-r--r--rules.js35
2 files changed, 34 insertions, 2 deletions
diff --git a/play.js b/play.js
index 936f75b..e180cd0 100644
--- a/play.js
+++ b/play.js
@@ -1100,6 +1100,7 @@ function on_update() {
action_button("roll", "Roll")
action_button("end_cavalry", "End Cavalry Selection")
+ action_button("skip", "Skip")
action_button("next", "Next")
action_button("undo", "Undo")
action_button("end_of_turn", "End your turn")
diff --git a/rules.js b/rules.js
index 99eed08..f8de694 100644
--- a/rules.js
+++ b/rules.js
@@ -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"
}
}