From b04313ff35213450d4c467017bd42aa19dc13e8c Mon Sep 17 00:00:00 2001 From: Joël Simoneau Date: Wed, 29 Jan 2025 15:58:00 -0500 Subject: Event 15. --- events.txt | 21 +++++++++++++++++++-- rules.js | 27 ++++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/events.txt b/events.txt index f26ec60..64b3546 100644 --- a/events.txt +++ b/events.txt @@ -173,10 +173,27 @@ SHADED 14 log "NOT IMPLEMENTED" EVENT 15 - log "NOT IMPLEMENTED" + prompt "Replace Governors with Rebelling Amirs in Provinces adjacent to Devagiri." + piece_opt all is_adjacent_to_city(C_DEVAGIRI, piece_space(p)) && can_place_piece(piece_space(p), BK, ELITE) && is_governor(p) + set_piece_space + mark_space + remove + auto_place_rebel BK ELITE + set_space -1 + endpiece + prompt "Remove a Tributary marker in one Province." + space_opt 1 is_tributary(s) && set_has(game.vm.m, s) + remove_tributary + endspace SHADED 15 - log "NOT IMPLEMENTED" + prompt "Replace an Amir with a Governor and place a Tributary marker in a Province adjacent to Devagiri." + space 1 is_adjacent_to_city(C_DEVAGIRI, s) && can_place_piece(s, DS, ELITE) && !is_tributary(s) + asm game.vm.p = find_piece(game.vm.s, BK, ELITE) + remove + auto_place DS ELITE + place_tributary + endspace EVENT 16 log "NOT IMPLEMENTED" diff --git a/rules.js b/rules.js index 1a3647d..7159809 100644 --- a/rules.js +++ b/rules.js @@ -258,7 +258,7 @@ exports.setup = function (seed, scenario, _options) { } function setup_deck() { - game.deck = [ 35, 29, 18, 5, 3, 36, 10, 37, 11, 2, 10, 1, 12, 13, 14 ] + game.deck = [ 35, 29, 15, 14, 16, 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_governor(p) { + return piece_faction(p) === DS && piece_type(p) === ELITE +} + function is_amir(p) { return piece_faction(p) === BK && piece_type(p) === ELITE } @@ -4310,13 +4314,30 @@ CODE[14 * 2 + 1] = [ // EVENT 15 CODE[15 * 2 + 0] = [ - [ vm_log, "NOT IMPLEMENTED" ], + [ vm_prompt, "Replace Governors with Rebelling Amirs in Provinces adjacent to Devagiri." ], + [ vm_piece, false, 0, 999, (p,s)=>is_adjacent_to_city(C_DEVAGIRI, piece_space(p)) && can_place_piece(piece_space(p), BK, ELITE) && is_governor(p) ], + [ vm_set_piece_space ], + [ vm_mark_space ], + [ vm_remove ], + [ vm_auto_place, false, 0, true, BK, ELITE ], + [ vm_set_space, -1 ], + [ vm_endpiece ], + [ vm_prompt, "Remove a Tributary marker in one Province." ], + [ vm_space, true, 0, 1, (s)=>is_tributary(s) && set_has(game.vm.m, s) ], + [ vm_remove_tributary ], + [ vm_endspace ], [ vm_return ], ] // SHADED 15 CODE[15 * 2 + 1] = [ - [ vm_log, "NOT IMPLEMENTED" ], + [ vm_prompt, "Replace an Amir with a Governor and place a Tributary marker in a Province adjacent to Devagiri." ], + [ vm_space, true, 1, 1, (s)=>is_adjacent_to_city(C_DEVAGIRI, s) && can_place_piece(s, DS, ELITE) && !is_tributary(s) ], + [ vm_asm, ()=>game.vm.p = find_piece(game.vm.s, BK, ELITE) ], + [ vm_remove ], + [ vm_auto_place, false, 0, false, DS, ELITE ], + [ vm_place_tributary ], + [ vm_endspace ], [ vm_return ], ] -- cgit v1.2.3