summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js26
1 files changed, 16 insertions, 10 deletions
diff --git a/rules.js b/rules.js
index 628ed0b..3fbb78d 100644
--- a/rules.js
+++ b/rules.js
@@ -4963,11 +4963,6 @@ function log_lord_engage(lord) {
log_lord_cap_ii(lord, AOW_LANCASTER_PIQUIERS);
log_lord_cap_ii(lord, AOW_YORK_BARRICADES);
}
-const battle_steps = [
- null,
- { name: "Missiles", hits: count_missile_hits },
- { name: "Melee", hits: count_melee_hits },
-];
function remove_lord_from_battle(lord) {
if (set_has(game.battle.reserves, lord)) {
array_remove(game.battle.reserves, lord);
@@ -5032,11 +5027,19 @@ function count_melee_hits(lord) {
}
return hits;
}
-function count_lord_hits(lord) {
- return battle_steps[game.battle.step].hits(lord);
+function total_lord_hits(lord) {
+ let hits = 0;
+ if (is_missiles_step())
+ hits += count_missile_hits(lord);
+ else
+ hits += count_melee_hits(lord);
+ return hits;
}
function format_strike_step() {
- return battle_steps[game.battle.step].name;
+ if (is_missiles_step())
+ return "Missiles";
+ else
+ return "Melee";
}
function format_hits() {
if (game.active !== game.battle.attacker && game.battle.ahits > 0)
@@ -6319,11 +6322,14 @@ function goto_total_hits() {
}
let ahits = 0;
let dhits = 0;
- log_h4(battle_steps[game.battle.step].name);
+ if (is_missiles_step())
+ log_h4("Missiles");
+ else
+ log_h4("Melee");
for (let pos of game.battle.engagements[0]) {
let lord = game.battle.array[pos];
if (lord !== NOBODY) {
- let hits = count_lord_hits(lord);
+ let hits = total_lord_hits(lord);
log_hits(hits / 2, "L" + lord);
hits += use_culverins(lord);
if (pos === A1 || pos === A2 || pos === A3)