diff options
author | Joël Simoneau <simoneaujoel@gmail.com> | 2025-03-14 19:32:02 -0400 |
---|---|---|
committer | Joël Simoneau <simoneaujoel@gmail.com> | 2025-03-14 19:32:02 -0400 |
commit | 38e7bf07d9ea82993c24423a16b3294ec491acd4 (patch) | |
tree | 5d7f63ee8e0630c171beda07c98171bddc31ff2c /rules.js | |
parent | 345abe547b99de96831b87b92afb88850db0de85 (diff) | |
download | vijayanagara-38e7bf07d9ea82993c24423a16b3294ec491acd4.tar.gz |
Better attack
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1170,6 +1170,7 @@ states.attack = { }, space(s) { push_undo() + game.cmd.selected = [] game.cmd.where = s select_cmd_space(game.cmd.where, 1) set_add(game.cmd.spaces, game.cmd.where) @@ -1240,7 +1241,7 @@ states.attack_adjacent_support = { if (game.cmd.support_space == null) { for (let s = first_space; s <= last_space; ++s) - if (can_support_from(s, game.cmd.attacker)) + if (is_adjacent(game.cmd.where, s) && can_support_from(s, game.cmd.attacker)) gen_action_space(s) } else { if (game.cmd.n_adj > 0) @@ -1258,14 +1259,15 @@ states.attack_adjacent_support = { view.actions.next = 1 }, space(s) { + push_undo() game.cmd.support_space = s }, piece(p) { + push_undo() set_add(game.cmd.selected, p) set_add(game.cmd.pieces, p) game.cmd.n_adj -= 1 game.cmd.n_units[0] += 1 - }, next() { game.state = "attack_space" @@ -1350,6 +1352,7 @@ states.attack_cavalry = { view.who = game.cmd.selected }, die(d) { + push_undo() if (!game.cmd.cavalry) { log(`${faction_acronyms[game.current]} is using Cavalry.`) game.cmd.cavalry = true @@ -1420,6 +1423,7 @@ states.attack_casualties = { }, piece(p) { + push_undo() remove_piece(p) set_delete(game.cmd.selected, p) game.cmd.count -= 1 |