diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-06-17 14:20:59 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:08:56 +0100 |
commit | d2b29dc23b9b4a4947c75a9c78acd90e26254488 (patch) | |
tree | 57ef631b198dcb8f8b8f76d0ab0dca66a164ca5d | |
parent | dd6ad74898427e5fb907519ed3859519aa71a809 (diff) | |
download | julius-caesar-d2b29dc23b9b4a4947c75a9c78acd90e26254488.tar.gz |
Add auto-hit option.
-rw-r--r-- | create.html | 6 | ||||
-rw-r--r-- | rules.js | 21 |
2 files changed, 26 insertions, 1 deletions
diff --git a/create.html b/create.html index 3ff4b7a..5a7fec9 100644 --- a/create.html +++ b/create.html @@ -11,7 +11,6 @@ deployed blocks in each city is maintained. </dl> <p> -Optional rules: <dl> <dt> <label><input type="checkbox" name="tournament" value="true">Tournament</label> @@ -34,3 +33,8 @@ House rules: <br><label><input type="checkbox" name="remove_pluto" value="true">Remove Pluto.</label> <br><label><input type="checkbox" name="remove_vulcan" value="true">Remove Vulcan.</label> --> + +<p> +<label><input type="checkbox" name="autohit" value="true"> +Automatically apply combat hits when possible. +</label> @@ -2092,6 +2092,24 @@ states.battle_round = { function goto_battle_hits() { game.battle_list = list_victims(game.active) + + if (game.autohit) { + let n = 0 + while (game.hits >= game.battle_list.length && game.battle_list.length > 0) { + while (game.battle_list.length > 0) { + let who = game.battle_list.pop() + log_battle(block_name(who) + " took a hit.") + reduce_block(who, 'combat') + game.hits-- + ++n + } + if (game.hits > 0) + game.battle_list = list_victims(game.active) + } + if (n > 0) + game.flash += ` Assigned ${n}.` + } + if (game.battle_list.length === 0) resume_battle() else @@ -2602,6 +2620,9 @@ exports.setup = function (seed, scenario, options) { if (options.automatic_disruption) game.automatic_disruption = 1 + if (options.autohit) + game.autohit = 1 + setup_historical_deployment() if (scenario === "Free Deployment") start_free_deployment() |