summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoël Simoneau <simoneaujoel@gmail.com>2025-03-05 15:54:54 -0500
committerJoël Simoneau <simoneaujoel@gmail.com>2025-03-05 15:54:54 -0500
commit6d20db3875e227cca6f4e1a9f9d99f53099e0c48 (patch)
treea48eb38addb66975cb4efb32b9693bc1194e720f
parentb2a945edbae951bd7836fc9552891a7540b284b6 (diff)
downloadvijayanagara-6d20db3875e227cca6f4e1a9f9d99f53099e0c48.tar.gz
Adjust MI attack.
-rw-r--r--rules.js31
1 files changed, 25 insertions, 6 deletions
diff --git a/rules.js b/rules.js
index 371d052..0f667ee 100644
--- a/rules.js
+++ b/rules.js
@@ -1175,8 +1175,8 @@ function next_attack_cavalry_step() {
} else if (game.cmd.step === 1) {
goto_attack_cavalry(game.cmd.target)
} else {
- game.cmd.a_hit = game.dice.slice(0,4).filter(d => d > 0 && d <= game.cmd.n_units[0]).length
- game.cmd.d_hit = game.dice.slice(4).filter(d => d > 0 && d <= game.cmd.n_units[1]).length
+ game.cmd.a_hit = game.dice.slice(0,4).filter(d => d > 0 && d <= game.cmd.n_units[0] && d < 6).length
+ game.cmd.d_hit = game.dice.slice(4).filter(d => d > 0 && d <= game.cmd.n_units[1] && d < 6).length
game.cmd.victor = get_attack_victor()
log_br()
log(`${faction_name[game.cmd.attacker]} scores ${game.cmd.a_hit} hits.`)
@@ -1187,10 +1187,10 @@ function next_attack_cavalry_step() {
function goto_attack_cavalry(curr) {
if (curr === MI && curr === game.cmd.target) {
- if (game.dice[4] - 1 === game.cmd.n_units[1]) {
+ if (game.dice[4] - 1 === game.cmd.n_units[1] || (game.dice[4] === 6 && game.cmd.n_units[1] >= 5)) {
log(`${faction_acronyms[game.current]} is using Cavalry.`)
attack_use_cavalry(4, MI)
- } else if (game.dice[5] - 1 === game.cmd.n_units[1]) {
+ } else if (game.dice[5] - 1 === game.cmd.n_units[1] || (game.dice[5] === 6 && game.cmd.n_units[1] >= 5)) {
log(`${faction_acronyms[game.current]} is using Cavalry.`)
attack_use_cavalry(5, MI)
}
@@ -1216,7 +1216,7 @@ states.attack_cavalry = {
curr_die = [0, 1, 2, 3]
if (has_cavalry(game.cmd.cav_faction))
for (let d of curr_die)
- if (game.dice[d] === 2 || game.dice[d] === game.cmd.n_units[0] + 1) {
+ if (game.dice[d] === 2 || game.dice[d] === game.cmd.n_units[0] + 1 || (game.dice[d] === 6 && game.cmd.n_units[0] >= 5)) {
gen_action_die(d)
can_charge = true
}
@@ -2393,9 +2393,17 @@ function goto_plunder_remove() {
}
}
+function has_troops_in_provinces() {
+ for (let s = first_space; s <= last_province; ++s) {
+ if (has_piece(s, DS, TROOPS))
+ return true
+ }
+ return false
+}
+
states.plunder_remove = {
prompt() {
- if (game.cmd.count > 0) {
+ if (game.cmd.count > 0 && has_troops_in_provinces()) {
view.prompt = `Attack & Plunder: Remove ${game.cmd.count} Troops from any Provinces.`
for (let s = first_space; s <= last_province; ++s) {
@@ -2420,6 +2428,17 @@ function end_plunder() {
if (game.summary && game.summary.length > 0) {
pop_summary()
}
+
+ let n = count_pieces(game.cmd.where, MI, TROOPS) - 3
+ if (n > 0) {
+ for (let i = 0; i < n; ++i) {
+ let p = find_piece(game.cmd.where, MI, TROOPS)
+ remove_piece(p)
+ }
+ log_br()
+ log(`${n} Invaders returned from ${SPACE_NAME[game.cmd.where]} with spoils.`)
+ }
+
game.current = game.cmd.sa_faction
goto_strategic_assistance()
}