diff options
-rw-r--r-- | rules.js | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -1249,6 +1249,19 @@ function get_supreme_commander(s) { return -1 } +function is_mixed_stack(s) { + let pow = -1 + for (let p of all_generals) { + if (game.pos[p] === s) { + if (pow < 0) + pow = piece_power[p] + else if (piece_power[p] !== pow) + return true + } + } + return false +} + function get_stack_power(s) { return piece_power[get_supreme_commander(s)] } @@ -3763,11 +3776,20 @@ function goto_resolve_combat() { game.count = a_troops - d_troops let a = get_supreme_commander(game.attacker) + let a_top = game.troops[a] let d = get_supreme_commander(game.defender) + let d_top = game.troops[d] log("!") log(`>P${a} at S${game.attacker}`) log(`>P${d} at S${game.defender}`) - log(`>Troops ${a_troops} - ${d_troops} = ${game.count}`) + if (is_mixed_stack(game.attacker) && is_mixed_stack(game.defender)) + log(`>Troops (${a_top}+${a_troops-a_top}) - (${d_top}+${d_troops-d_top}) = ${game.count}`) + else if (is_mixed_stack(game.attacker)) + log(`>Troops (${a_top}+${a_troops-a_top}) - ${d_troops} = ${game.count}`) + else if (is_mixed_stack(game.defender)) + log(`>Troops ${a_troops} - (${d_top}+${d_troops-d_top}) = ${game.count}`) + else + log(`>Troops ${a_troops} - ${d_troops} = ${game.count}`) if (game.count <= 0) { set_active_attacker() |