summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorJoël Simoneau <simoneaujoel@gmail.com>2025-03-09 14:59:32 -0400
committerJoël Simoneau <simoneaujoel@gmail.com>2025-03-09 14:59:32 -0400
commit9b9cc01d9a8d8e177a8ba3f3b6245adc875ee506 (patch)
tree568e48341a6ae081bc6a3ac3aaf3a6efd444e9b9 /rules.js
parent1499afe7b4fa9b7e87736106f83dff390d0e3ddb (diff)
downloadvijayanagara-9b9cc01d9a8d8e177a8ba3f3b6245adc875ee506.tar.gz
Event 28.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js59
1 files changed, 46 insertions, 13 deletions
diff --git a/rules.js b/rules.js
index a1eab39..8b7d30f 100644
--- a/rules.js
+++ b/rules.js
@@ -997,6 +997,12 @@ function roll_attack() {
if (game.cmd.target === BK && has_piece(game.cmd.where, BK, DISC))
game.dice[3] = 0
+
+ let is_shaded_28 = (game.vm && game.vm.fp === 57)
+ if (is_shaded_28) {
+ game.dice[4] = 0
+ game.dice[5] = 0
+ }
}
function attack_use_cavalry(d, f) {
@@ -2933,7 +2939,7 @@ function gen_take_cavalry(faction) {
return can_place
}
-function gen_take_faction_cavalry(faction) {
+function gen_action_faction_cavalry(faction) {
for (let c = 0; c <= LAST_CAVALRY; ++c)
if (game.cavalry[c] === faction)
gen_action_token(c)
@@ -4255,6 +4261,15 @@ function vm_gain_cavalry() {
goto_cavalry(vm_operand(1), "")
}
+function vm_spend_cavalry() {
+ let n = vm_inst(1)
+ for (let i = 0; i < n; ++i) {
+ game.cavalry[find_cavalry(game.current)] = AVAILABLE
+ }
+ log(`${faction_name[game.current]} spends ${n} Cavalry token.`)
+ vm_next()
+}
+
// VM: INFLUENCE
function vm_add_influence() {
@@ -4379,7 +4394,7 @@ states.vm_steal_cavalry = {
view.actions.skip = 1
} else {
event_prompt(`Steal ${n} Calvary token from ${faction_name[f2]}.`)
- gen_take_faction_cavalry(f2)
+ gen_action_faction_cavalry(f2)
}
},
token(c) {
@@ -4524,9 +4539,7 @@ states.vm_conspire_trade = {
// VM: EVENT_4
-function vm_event_4() {
- game.state = "event_4"
-}
+function vm_event_4() { game.state = "event_4" }
states.event_4 = {
prompt() {
@@ -4557,9 +4570,7 @@ function vm_shaded_6() {
game.state = "campaign"
}
-function vm_shaded_6_2() {
- game.state = "shaded_6_2"
-}
+function vm_shaded_6_2() { game.state = "shaded_6_2" }
states.shaded_6_2 = {
prompt() {
@@ -4580,9 +4591,7 @@ states.shaded_6_2 = {
// VM: EVENT_25
-function vm_event_25() {
- game.state = "event_25"
-}
+function vm_event_25() { game.state = "event_25" }
states.event_25 = {
prompt() {
@@ -5386,13 +5395,37 @@ CODE[27 * 2 + 1] = [
// EVENT 28
CODE[28 * 2 + 0] = [
- [ vm_log, "NOT IMPLEMENTED" ],
+ [ vm_add_influence, BK ],
+ [ vm_remove_influence, VE ],
+ [ vm_current, BK ],
+ [ vm_prompt, "Spend a Cavalry token to place 2 Amirs and remove a Raja in Andhra." ],
+ [ vm_space, true, 1, 1, (s)=>((s === S_ANDHRA) && (n_cavalry(BK) > 0)) ],
+ [ vm_spend_cavalry, 1 ],
+ [ vm_auto_place, false, 0, false, BK, ELITE ],
+ [ vm_auto_place, false, 0, false, BK, ELITE ],
+ [ vm_piece, false, 1, 1, (p,s)=>(is_raja(p) && is_piece_in_event_space(p)) ],
+ [ vm_remove ],
+ [ vm_endpiece ],
+ [ vm_endspace ],
[ vm_return ],
]
// SHADED 28
CODE[28 * 2 + 1] = [
- [ vm_log, "NOT IMPLEMENTED" ],
+ [ vm_current, [DS, VE] ],
+ [ vm_if, ()=>(game.current === DS) ],
+ [ vm_prompt, "In a space with Bahmani presence, you may add 2 Troops and free Attack without defenders." ],
+ [ vm_else ],
+ [ vm_prompt, "In a space with Bahmani presence, you may add 2 Rajas and free Attack without defenders." ],
+ [ vm_endif ],
+ [ vm_space, true, 1, 1, (s)=>(has_piece_faction(s, BK)) ],
+ [ vm_if, ()=>(game.current === DS) ],
+ [ vm_place, false, 1, 2, DS, TROOPS ],
+ [ vm_else ],
+ [ vm_place, false, 1, 2, VE, ELITE ],
+ [ vm_endif ],
+ [ vm_free_attack, BK ],
+ [ vm_endspace ],
[ vm_return ],
]