diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-01-19 14:57:07 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:19:39 +0100 |
commit | f2d9c93f40313db7a0d8987dc550263492c0c21a (patch) | |
tree | 451fa0041deea2a791ffc111676d6707c7aea37e | |
parent | 4861c41e8c8cfad2779f8773947856b58fe0c876 (diff) | |
download | crusader-rex-f2d9c93f40313db7a0d8987dc550263492c0c21a.tar.gz |
Log combat hits taken.
-rw-r--r-- | rules.js | 43 |
1 files changed, 32 insertions, 11 deletions
@@ -2961,13 +2961,21 @@ states.field_battle_hits = { block: apply_field_battle_hit, } -function apply_field_battle_hit(who) { +function apply_field_battle_hit_to(who, flash) { + let msg; if (block_plural(who)) - game.flash = block_name(who) + " take a hit."; + msg = block_name(who) + " take a hit."; else - game.flash = block_name(who) + " takes a hit."; - reduce_block(who, 'combat'); + msg = block_name(who) + " takes a hit."; + log(game.active[0] + ": " + msg); + if (flash) + game.flash = msg; + reduce_block(who); game.hits--; +} + +function apply_field_battle_hit(who) { + apply_field_battle_hit_to(who, true); if (game.hits === 0) resume_field_battle(); else { @@ -3019,22 +3027,35 @@ states.siege_battle_hits = { block: apply_siege_battle_hit, } -function apply_siege_battle_hit(who) { +function apply_siege_battle_hit_to(who, flash) { + let msg; if (block_plural(who)) - game.flash = block_name(who) + " take a hit."; + msg = block_name(who) + " take a "; else - game.flash = block_name(who) + " takes a hit."; + msg = block_name(who) + " takes a "; if (game.halfhit === who) { - reduce_block(who, 'combat'); + msg += "hit."; + log(game.active[0] + ": " + msg); + reduce_block(who); game.halfhit = null; } else { - if (is_block_in_castle(who)) + if (is_block_in_castle(who)) { + msg += "half-hit."; + log(game.active[0] + ": " + msg); game.halfhit = who; - else - reduce_block(who, 'combat'); + } else { + msg += "hit."; + log(game.active[0] + ": " + msg); + reduce_block(who); + } } + if (flash) + game.flash = msg; game.hits--; +} +function apply_siege_battle_hit(who) { + apply_siege_battle_hit_to(who, true); if (game.hits === 0) { resume_siege_battle(); } else { |