diff options
author | Joël Simoneau <simoneaujoel@gmail.com> | 2025-01-23 13:02:17 -0500 |
---|---|---|
committer | Joël Simoneau <simoneaujoel@gmail.com> | 2025-01-23 13:02:17 -0500 |
commit | 4942907e4c771c8fe81a9693efec42e15d540bf8 (patch) | |
tree | 18323298a99f4b230c209d0539e935561dfb2c6b | |
parent | fc0e6ce45c145b8e3f80cab861f70254da957e62 (diff) | |
download | vijayanagara-4942907e4c771c8fe81a9693efec42e15d540bf8.tar.gz |
Event 32
-rw-r--r-- | events.txt | 14 | ||||
-rw-r--r-- | rules.js | 64 |
2 files changed, 63 insertions, 15 deletions
@@ -328,10 +328,20 @@ SHADED 31 log "NOT IMPLEMENTED" EVENT 32 - log "NOT IMPLEMENTED" + current REBEL_FACTIONS + add_influence (game.current) + remove_influence (other_rebel_faction(game.current)) + prompt `Replace up to 2 ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}s with 2 ${PIECE_FACTION_TYPE_NAME[other_rebel_faction(game.current)][ELITE]}s.` + piece_opt 2 is_enemy_piece(p) && is_rebel_faction_elite(p) && is_piece_on_map(p) + set_piece_space + remove + auto_place (game.current) ELITE + set_space -1 + endpiece SHADED 32 - log "NOT IMPLEMENTED" + remove_influence BK + remove_influence VE EVENT 33 current (has_majority_goa()) @@ -258,7 +258,7 @@ exports.setup = function (seed, scenario, _options) { } function setup_deck() { - game.deck = [ 30, 29, 28, 27, 23, 8, 7, 6, 5, 3, 36, 10, 37, 11, 2, 10, 1, 12, 13, 14 ] + game.deck = [ 30, 29, 28, 27, 32, 23, 8, 7, 6, 5, 3, 36, 10, 37, 11, 2, 10, 1, 12, 13, 14 ] } function setup_standard() { @@ -2229,6 +2229,10 @@ function is_rebel_faction_elite(p) { return (piece_type(p) === ELITE && [BK, VE].includes(piece_faction(p))) } +function other_rebel_faction(faction) { + return faction === VE ? BK : VE +} + function remove_tributary(s) { game.tributary &= ~(1 << s) update_control() @@ -2570,6 +2574,10 @@ function is_piece_in_event_space(p) { return piece_space(p) === game.vm.s } +function is_piece_on_map(p) { + return piece_space(p) > AVAILABLE && piece_space(p) <= S_MONGOL_INVADERS +} + /* EVENT SPECIFIC */ function has_majority_goa() { @@ -2652,6 +2660,8 @@ function add_influence(faction) { move_all_faction_piece_from(BK, ELITE, S_BK_INF_4, AVAILABLE) else if (faction === VE) move_all_faction_piece_from(VE, ELITE, S_VE_INF_1 + game.inf[faction] - 1, AVAILABLE) + else if (game.vm) + vm_next() } function remove_influence(faction) { @@ -2659,6 +2669,8 @@ function remove_influence(faction) { return game.inf[faction]-- + log(faction_name[faction] + " loses influence.") + update_vp() if (faction === BK && game.inf[faction] === 3) troops_to_inf_track(BK, S_BK_INF_4) @@ -2666,6 +2678,8 @@ function remove_influence(faction) { troops_to_inf_track(BK, S_BK_INF_2) else if (faction === VE) troops_to_inf_track(VE, S_VE_INF_1 + game.inf[faction]) + else if (game.vm) + vm_next() } function troops_to_inf_track(faction, s) { @@ -2681,7 +2695,9 @@ function troops_to_inf_track(faction, s) { if (moved < 2) { goto_return_troops(faction, 2-moved, s) - } else { + } else if (game.vm) { + vm_next() + } else{ game.state = game.inf_shift.next } } @@ -2718,8 +2734,12 @@ states.return_troops = { }, end_return() { pop_summary() - game.current = game.inf_shift.save_current - game.state = game.inf_shift.next + if (game.vm) + vm_next() + else { + game.current = game.inf_shift.save_current + game.state = game.inf_shift.next + } } } @@ -3455,7 +3475,6 @@ states.vm_current = { function vm_exec() { - console.log(game.vm.ip) vm_inst(0)() } @@ -3820,8 +3839,17 @@ states.vm_place = { // VM: INFLUENCE function vm_add_influence() { - add_influence(vm_operand(1)) - vm_next() + if (game.inf[vm_operand(1)] !== 4) + add_influence(vm_operand(1)) + else + vm_next() +} + +function vm_remove_influence() { + if (game.inf[vm_operand(1)] !== 0) + remove_influence(vm_operand(1)) + else + vm_next() } // VM: RESOURCES @@ -4410,8 +4438,8 @@ CODE[27 * 2 + 0] = [ [ vm_place, false, 1, 2, BK, ELITE ], [ vm_endspace ], [ vm_prompt, "Place a Fort and remove a Tributary marker in Sindh." ], - [ vm_space, true, 0, 1, (s)=>(s === S_SINDH) ], - [ vm_place, false, 1, 1, BK, DISC ], + [ vm_space, true, 1, 1, (s)=>(s === S_SINDH) ], + [ vm_place, false, 0, 1, BK, DISC ], [ vm_remove_tributary ], [ vm_endspace ], [ vm_return ], @@ -4426,8 +4454,8 @@ CODE[27 * 2 + 1] = [ [ vm_place, false, 1, 1, DS, ELITE ], [ vm_endspace ], [ vm_prompt, "Place a Qasbah and a Tributary marker in Sindh." ], - [ vm_space, true, 0, 1, (s)=>(s === S_SINDH) ], - [ vm_place, false, 1, 1, DS, DISC ], + [ vm_space, true, 1, 1, (s)=>(s === S_SINDH) ], + [ vm_place, false, 0, 1, DS, DISC ], [ vm_place_tributary ], [ vm_endspace ], [ vm_return ], @@ -4483,13 +4511,23 @@ CODE[31 * 2 + 1] = [ // EVENT 32 CODE[32 * 2 + 0] = [ - [ vm_log, "NOT IMPLEMENTED" ], + [ vm_current, REBEL_FACTIONS ], + [ vm_add_influence, ()=>(game.current) ], + [ vm_remove_influence, ()=>(other_rebel_faction(game.current)) ], + [ vm_prompt, ()=>`Replace up to 2 ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}s with 2 ${PIECE_FACTION_TYPE_NAME[other_rebel_faction(game.current)][ELITE]}s.` ], + [ vm_piece, false, 0, 2, (p,s)=>is_enemy_piece(p) && is_rebel_faction_elite(p) && 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_return ], ] // SHADED 32 CODE[32 * 2 + 1] = [ - [ vm_log, "NOT IMPLEMENTED" ], + [ vm_remove_influence, BK ], + [ vm_remove_influence, VE ], [ vm_return ], ] |