From de24fe20e2a70a4cf5180495bed98ccede689e47 Mon Sep 17 00:00:00 2001 From: Joël Simoneau Date: Wed, 29 Jan 2025 12:54:17 -0500 Subject: Event 18. --- rules.js | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 1ba60fe..1a3647d 100644 --- a/rules.js +++ b/rules.js @@ -258,7 +258,7 @@ exports.setup = function (seed, scenario, _options) { } function setup_deck() { - game.deck = [ 35, 29, 28, 24, 32, 23, 8, 7, 6, 5, 3, 36, 10, 37, 11, 2, 10, 1, 12, 13, 14 ] + game.deck = [ 35, 29, 18, 5, 3, 36, 10, 37, 11, 2, 10, 1, 12, 13, 14 ] } function setup_standard() { @@ -2578,6 +2578,10 @@ function is_ds_unit(p) { return (is_piece(p, DS, ELITE) || is_piece(p, DS, TROOPS)) } +function is_amir(p) { + return piece_faction(p) === BK && piece_type(p) === ELITE +} + function is_raja(p) { return piece_faction(p) === VE && piece_type(p) === ELITE } @@ -2610,6 +2614,14 @@ function has_majority_goa() { return c.filter(n => n === max).length > 1 ? 1 : c.indexOf(max) } +function n_province_with_both_rebels() { + let n = 0 + for (let s = first_space; s <= last_province; ++s) { + if (has_piece_faction(s, VE) && has_piece_faction(s, BK)) + n += 1 + } + return n +} /* CAVALRY */ @@ -4334,13 +4346,27 @@ CODE[17 * 2 + 1] = [ // EVENT 18 CODE[18 * 2 + 0] = [ - [ vm_log, "NOT IMPLEMENTED" ], + [ vm_if, ()=>n_province_with_both_rebels() > 0 ], + [ vm_repeat, ()=>(n_province_with_both_rebels()) ], + [ vm_add_influence, BK ], + [ vm_endrepeat ], + [ vm_else ], + [ vm_log, "No Province shared." ], + [ vm_endif ], [ vm_return ], ] // SHADED 18 CODE[18 * 2 + 1] = [ - [ vm_log, "NOT IMPLEMENTED" ], + [ vm_current, [DS, VE] ], + [ vm_prompt, ()=>`Replace an Amir with a ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.` ], + [ vm_piece, false, 0, 1, (p,s)=>is_amir(p) && can_place_piece(s, game.current, ELITE) && is_piece_on_map(p) ], + [ vm_set_piece_space ], + [ vm_remove ], + [ vm_auto_place, false, 0, false, ()=>(game.current), ELITE ], + [ vm_set_space, -1 ], + [ vm_endpiece ], + [ vm_remove_influence, BK ], [ vm_return ], ] -- cgit v1.2.3