summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoël Simoneau <simoneaujoel@gmail.com>2025-01-29 12:54:17 -0500
committerJoël Simoneau <simoneaujoel@gmail.com>2025-01-29 12:54:17 -0500
commitde24fe20e2a70a4cf5180495bed98ccede689e47 (patch)
tree0d36da0efbe7aab53e11561324fc9dd6ad621cf9
parentade5e4c38ece43cc12f5096de2251d3192aa5a1d (diff)
downloadvijayanagara-de24fe20e2a70a4cf5180495bed98ccede689e47.tar.gz
Event 18.
-rw-r--r--events.txt18
-rw-r--r--rules.js32
2 files changed, 45 insertions, 5 deletions
diff --git a/events.txt b/events.txt
index 911fc0d..f26ec60 100644
--- a/events.txt
+++ b/events.txt
@@ -191,10 +191,24 @@ SHADED 17
log "NOT IMPLEMENTED"
EVENT 18
- log "NOT IMPLEMENTED"
+ if n_province_with_both_rebels() > 0
+ repeat (n_province_with_both_rebels())
+ add_influence BK
+ endrepeat
+ else
+ log "No Province shared."
+ endif
SHADED 18
- log "NOT IMPLEMENTED"
+ current [DS VE]
+ prompt `Replace an Amir with a ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.`
+ piece_opt 1 is_amir(p) && can_place_piece(s, game.current, ELITE) && is_piece_on_map(p)
+ set_piece_space
+ remove
+ auto_place (game.current) ELITE
+ set_space -1
+ endpiece
+ remove_influence BK
EVENT 19
current REBEL_FACTIONS
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 ],
]