summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorJoël Simoneau <simoneaujoel@gmail.com>2025-02-20 13:42:41 -0500
committerJoël Simoneau <simoneaujoel@gmail.com>2025-02-20 13:42:41 -0500
commit55fff141cd83aa37b35519946034016af78f0d82 (patch)
tree58480276d4c99f9b3abd83b51be08bf04c764a76 /rules.js
parente0840225f0fa64a46c07c5ffea67330c2e64a504 (diff)
downloadvijayanagara-55fff141cd83aa37b35519946034016af78f0d82.tar.gz
Add influence shift for attack
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/rules.js b/rules.js
index 1905b3d..d11441a 100644
--- a/rules.js
+++ b/rules.js
@@ -1115,7 +1115,7 @@ function goto_attack_space() {
set_add(game.cmd.selected, p)
set_add(game.cmd.pieces, p)
game.cmd.n_units[1] += 1
- if (game.cmd.target === BK || game.cmd.target === VE)
+ if (game.cmd.attacker === DS)
to_rebel(p)
}
})
@@ -1128,6 +1128,8 @@ function goto_attack_space() {
set_add(game.cmd.selected, p)
set_add(game.cmd.pieces, p)
game.cmd.n_units[0] += 1
+ if ((game.cmd.attacker === BK || game.cmd.attacker === VE) && game.cmd.target === DS)
+ to_rebel(p)
}
})
game.cmd.n_adj = (game.current === VE) ? 1 : 2
@@ -1310,12 +1312,30 @@ function end_attack_casualties() {
}
function goto_attack_resolution() {
- if (is_rebel_faction(game.cmd.target) && is_rebel_faction(game.cmd.attacker))
- console.log("Implement shift")
game.dice = [0, 0, 0, 0, 0, 0]
+ if (is_rebel_faction(game.cmd.target) && is_rebel_faction(game.cmd.attacker))
+ attack_influence_shift()
game.state = "attack"
}
+function attack_influence_shift() {
+ let up = null, down = null
+ if (game.cmd.a_hit > game.cmd.d_hit) {
+ up = game.cmd.attacker
+ down = game.cmd.target
+ } else if (game.cmd.a_hit < game.cmd.d_hit) {
+ down = game.cmd.attacker
+ up = game.cmd.target
+ }
+
+ if (up) {
+ game.inf_shift = { "next": "attack" }
+ add_influence(up)
+ remove_influence(down)
+ } else {
+ game.state = "attack"
+ }
+}
/* DELHI SULTANATE COMMANDS */