diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-08-27 21:32:00 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-08-27 21:32:00 +0200 |
commit | f3f0e8e257c9696f9a7416b349d489aeb8d45b14 (patch) | |
tree | 872ab1a9c8c8d57aba3fe4f201851fbf3a28903d | |
parent | 778582e533b7800c4b802045cef7fb279aa626fa (diff) | |
download | richard-iii-f3f0e8e257c9696f9a7416b349d489aeb8d45b14.tar.gz |
don't count Henry VI (and "dead" mercenary blocks) for anything.
-rw-r--r-- | rules.js | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -656,7 +656,7 @@ function count_enemy_excluding_reserves(where) { let p = ENEMY[game.active] let count = 0 for (let b = 0; b < block_count; ++b) - if (game.location[b] === where && block_owner(b) === p) + if (game.location[b] === where && block_owner(b) === p && !set_has(game.dead, b)) if (!set_has(game.reserves, b)) ++count return count @@ -771,7 +771,7 @@ function count_pinning(where) { function count_pinned(where) { let count = 0 for (let b = 0; b < block_count; ++b) - if (game.location[b] === where && block_owner(b) === game.active) + if (game.location[b] === where && block_owner(b) === game.active && !set_has(game.dead, b)) if (!set_has(game.reserves, b)) ++count return count @@ -1083,7 +1083,7 @@ function count_defenders() { function count_blocks_exclude_mercenaries(where) { let count = 0 for (let b = 0; b < block_count; ++b) - if (game.location[b] === where && !is_mercenary(b) && !(game.reduced && set_has(game.reduced, b))) + if (game.location[b] === where && !is_mercenary(b) && !set_has(game.dead, b) && !(game.reduced && set_has(game.reduced, b))) ++count return count } @@ -1091,20 +1091,20 @@ function count_blocks_exclude_mercenaries(where) { function count_blocks(where) { let count = 0 for (let b = 0; b < block_count; ++b) - if (game.location[b] === where && !(game.reduced && set_has(game.reduced, b))) + if (game.location[b] === where && !set_has(game.dead, b) && !(game.reduced && set_has(game.reduced, b))) ++count return count } function add_blocks_exclude_mercenaries(list, where) { for (let b = 0; b < block_count; ++b) - if (game.location[b] === where && !is_mercenary(b) && !(game.reduced && set_has(game.reduced, b))) + if (game.location[b] === where && !is_mercenary(b) && !set_has(game.dead, b) && !(game.reduced && set_has(game.reduced, b))) set_add(list, b) } function add_blocks(list, where) { for (let b = 0; b < block_count; ++b) - if (game.location[b] === where && !(game.reduced && set_has(game.reduced, b))) + if (game.location[b] === where && !set_has(game.dead, b) && !(game.reduced && set_has(game.reduced, b))) set_add(list, b) } @@ -1604,7 +1604,7 @@ states.plague_event = { game.where = where game.plague = [] for (let b = 0; b < block_count; ++b) - if (game.location[b] === where) + if (game.location[b] === where && !set_has(game.dead, b)) set_add(game.plague, b) game.active = ENEMY[game.active] game.state = 'apply_plague' @@ -2137,7 +2137,7 @@ states.treason_event = { function bring_on_reserves(owner, moved) { for (let b = 0; b < block_count; ++b) { - if (block_owner(b) === owner && game.location[b] === game.where) { + if (block_owner(b) === owner && game.location[b] === game.where && !set_has(game.dead, b)) { set_delete(game.reserves, b) if (moved) set_add(game.moved, b) @@ -2726,7 +2726,7 @@ states.regroup = { gen_action_undo(view) gen_action(view, 'end_regroup') for (let b = 0; b < block_count; ++b) { - if (game.location[b] === game.where) { + if (game.location[b] === game.where && !set_has(game.dead, b)) { if (is_attacker_with_piracy()) { if (set_has(game.is_pirate, b)) gen_action(view, 'block', b) @@ -3142,7 +3142,7 @@ function goto_pretender_goes_home() { game.turn_log = [] let choices = false for (let b = 0; b < block_count; ++b) - if (block_owner(b) === game.active && is_block_on_map(b)) + if (block_owner(b) === game.active && is_block_on_map(b) && !set_has(game.dead, b)) if (pretender_go_home_if_possible(b)) choices = true if (!choices) { @@ -3160,7 +3160,7 @@ states.pretender_goes_home = { gen_action_undo(view) let done = true for (let b = 0; b < block_count; ++b) { - if (block_owner(b) === game.active && is_block_on_map(b) && !set_has(game.moved, b)) { + if (block_owner(b) === game.active && is_block_on_map(b) && !set_has(game.dead, b) && !set_has(game.moved, b)) { if (!is_in_exile(b)) { if (is_heir(b)) { done = false @@ -3177,7 +3177,7 @@ states.pretender_goes_home = { if (done) { view.prompt = "Pretender Goes Home: You may move nobles to another home." for (let b = 0; b < block_count; ++b) { - if (block_owner(b) === game.active && is_block_on_map(b) && !set_has(game.moved, b)) { + if (block_owner(b) === game.active && is_block_on_map(b) && !set_has(game.dead, b) && !set_has(game.moved, b)) { if (!is_in_exile(b)) { if (is_at_home(b)) { let n = count_available_homes(b) @@ -3282,7 +3282,7 @@ function goto_king_goes_home() { game.turn_log = [] let choices = false for (let b = 0; b < block_count; ++b) - if (block_owner(b) === game.active && is_block_on_map(b)) + if (block_owner(b) === game.active && is_block_on_map(b) && !set_has(game.dead, b)) if (king_go_home_if_possible(b)) choices = true if (!choices) { @@ -3300,7 +3300,7 @@ states.king_goes_home = { gen_action_undo(view) let done = true for (let b = 0; b < block_count; ++b) { - if (block_owner(b) === game.active && is_block_on_map(b) && !set_has(game.moved, b)) { + if (block_owner(b) === game.active && is_block_on_map(b) && !set_has(game.dead, b) && !set_has(game.moved, b)) { if (!is_in_exile(b)) { if (!is_at_home(b)) { done = false @@ -3314,7 +3314,7 @@ states.king_goes_home = { if (done) { view.prompt = "King Goes Home: You may move nobles and heirs to another home." for (let b = 0; b < block_count; ++b) { - if (block_owner(b) === game.active && is_block_on_map(b) && !set_has(game.moved, b)) { + if (block_owner(b) === game.active && is_block_on_map(b) && !set_has(game.dead, b) && !set_has(game.moved, b)) { if (!is_in_exile(b)) { if (is_at_home(b)) { let n = count_available_homes(b) |