diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-01-31 17:10:51 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 11:54:52 +0100 |
commit | 99789e0e56bf6ff40e795f4866d7b7ecb9328b69 (patch) | |
tree | 24b226d2c7bb4991f6430881f545f843410c6e50 /rules.js | |
parent | c2909f455b414518e864787bfcef194a56318493 (diff) | |
download | wilderness-war-99789e0e56bf6ff40e795f4866d7b7ecb9328b69.tar.gz |
Fix attacking unit enumeration during assault.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 41 |
1 files changed, 13 insertions, 28 deletions
@@ -1,26 +1,20 @@ "use strict"; -// INTERRUPT CARDS: -// Card 13 - Blockhouses (before enemy rolls on raid table) -// Card 14 - Foul Weather (when enemy is about to move) -// Card 15 - Lake Schooner (when enemy moves into friendly fortification along lake etc) - -// TODO: show british leader pool -// TODO: show discard/removed card list in UI +// TODO: rename node/space -> location/space or raw_space/space or box/space? +// TODO: replace piece[p].type lookups with index range checks +// TODO: move core of is_friendly/enemy to is_british/french and branch in is_friendly/enemy -// TODO: re-evaluate fortress ownership and VP when pieces move or are eliminated // TODO: add/remove 'next' steps at end of states -// TODO: rename node/space -> location/space or raw_space/space or box/space? -// TODO: replace piece[p].type lookups with index range checks +// TODO: show british leader pool +// TODO: show discard/removed card list in UI // TODO: track 'held' +// TODO: only move pieces once per campaign -// TODO: move core of is_friendly/enemy to is_british/french and branch in is_friendly/enemy +// TODO: re-evaluate fortress ownership and VP when pieces move or are eliminated // TODO: update indian alliance markers when placing/eliminating indians -// TODO: only move pieces once per campaign - // REACTION CARDS /* @@ -1783,8 +1777,6 @@ function pq_pop(queue) { } function search_boat_move(who, start_space, start_cost, max_cost) { - max_cost *= 2; // use odd numbers for paths with one land connection - let move_cost = game.move.cost = {}; let move_path = game.move.path = {}; @@ -3151,27 +3143,20 @@ function end_avoid_battle() { // BATTLE function for_each_attacking_piece(fn) { - let force; - if (game.battle.assault) - force = find_friendly_commanding_leader_in_space(game.battle.where); - else - force = game.move.moving; - for_each_piece_in_force(force, fn); - /* - let where = game.battle.where; - if (game.battle.breaking_siege) { - } else { + if (game.battle.assault) { + let where = game.battle.where; if (game.battle.attacker === BRITAIN) { for (let p = first_british_piece; p <= last_british_piece; ++p) - if (is_piece_unbesieged(p) && is_piece_in_space(p, where)) + if (is_piece_in_space(p, where)) fn(p); } else { for (let p = first_french_piece; p <= last_french_piece; ++p) - if (is_piece_unbesieged(p) && is_piece_in_space(p, where)) + if (is_piece_in_space(p, where)) fn(p); } + } else { + for_each_piece_in_force(game.move.moving, fn); } - */ } function for_each_defending_piece(fn) { |