diff options
-rw-r--r-- | rules.js | 28 |
1 files changed, 25 insertions, 3 deletions
@@ -359,7 +359,29 @@ function available_home(who) { return where } -function go_home_if_possible(who) { +function pretender_go_home_if_possible(who) { + if (!is_in_exile(who)) { + // pretender heirs must go home! + if (is_heir(who)) + return true + let n = count_available_homes(who) + if (n === 0) { + game.turn_log.push([block_name(who), "Pool"]) + disband(who) + } else if (n === 1) { + let home = available_home(who) + if (game.location[who] !== home) { + game.location[who] = home + game.turn_log.push([block_name(who), "#" + game.location[who]]) // TODO: "Home"? + } + } else { + return true + } + } + return false +} + +function king_go_home_if_possible(who) { if (!is_in_exile(who)) { let n = count_available_homes(who) if (n === 0) { @@ -3100,7 +3122,7 @@ function goto_pretender_goes_home() { let choices = false for (let b = 0; b < block_count; ++b) if (block_owner(b) === game.active && is_block_on_map(b)) - if (go_home_if_possible(b)) + if (pretender_go_home_if_possible(b)) choices = true if (!choices) { print_turn_log_no_count("Pretender went home:") @@ -3240,7 +3262,7 @@ function goto_king_goes_home() { let choices = false for (let b = 0; b < block_count; ++b) if (block_owner(b) === game.active && is_block_on_map(b)) - if (go_home_if_possible(b)) + if (king_go_home_if_possible(b)) choices = true if (!choices) { print_turn_log_no_count("King went home:") |