diff options
author | Joël Simoneau <simoneaujoel@gmail.com> | 2025-03-09 17:01:40 -0400 |
---|---|---|
committer | Joël Simoneau <simoneaujoel@gmail.com> | 2025-03-09 17:01:40 -0400 |
commit | d8147052938607a450986064b662c42d28a37442 (patch) | |
tree | eadc9c99e493fbe95a7680ff9a4fdee86c74b88e /rules.js | |
parent | 9b9cc01d9a8d8e177a8ba3f3b6245adc875ee506 (diff) | |
download | vijayanagara-d8147052938607a450986064b662c42d28a37442.tar.gz |
Event 31.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 96 |
1 files changed, 67 insertions, 29 deletions
@@ -1621,6 +1621,9 @@ states.migrate_space = { if (game.cmd.count > 0) view.actions.next = 1 + if (game.vm && game.vm.fp === 62 && game.cmd.count === 0) + view.actions.skip = 1 + }, piece(p) { log_summary_move_from(p) @@ -1647,6 +1650,9 @@ states.migrate_space = { } else { game.state = "migrate" } + }, + skip() { + vm_next() } } @@ -2840,7 +2846,7 @@ function is_enemy_piece(p) { } function is_enemy_unit(p) { - return is_enemy_piece(p) && piece_type(p) !== DISC + return is_enemy_piece(p) && (piece_type(p) !== DISC) } function is_piece(p, faction, type) { @@ -2998,21 +3004,20 @@ function add_influence(faction) { function remove_influence(faction) { if (game.inf[faction] === 0) { end_influence() - return + } else { + 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) + else if (faction === BK && game.inf[faction] === 1) + 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 + end_influence() } - - 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) - else if (faction === BK && game.inf[faction] === 1) - 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 - end_influence() } function end_influence() { @@ -4437,16 +4442,20 @@ function vm_remove_tributary() { // VM: ATTACK function vm_free_attack() { - init_free_command("Attack", game.vm.s) - game.cmd.attacker = game.current - game.cmd.support_space = null - - if (typeof vm_inst(1) !== "undefined") { - game.cmd.selected = [] - game.cmd.target = vm_inst(1) - goto_attack_space() - } else { - goto_attack_select() + if (!can_attack_in_space(game.vm.s)) + vm_next() + else { + init_free_command("Attack", game.vm.s) + game.cmd.attacker = game.current + game.cmd.support_space = null + + if (typeof vm_inst(1) !== "undefined") { + game.cmd.selected = [] + game.cmd.target = vm_inst(1) + goto_attack_space() + } else { + goto_attack_select() + } } } @@ -4503,7 +4512,15 @@ function vm_free_march() { function vm_free_migrate() { let shift = (game.cmd && game.cmd.shift) ? true : false - init_free_command("Migrate", game.vm.s) + game.cmd = { + type: "Migrate", + limited: 1, + free: 1, + spaces: [], + selected: [], + pieces: [], + where: game.vm.s, + } game.cmd.pieces = game.vm.pp game.cmd.shift = shift goto_migrate_space() @@ -4821,7 +4838,7 @@ CODE[6 * 2 + 0] = [ // SHADED 6 CODE[6 * 2 + 1] = [ [ vm_current, DS ], - [ vm_prompt, "Campaign: Select four contiguous spaces, finishing adjacent to Warangal" ], + [ vm_prompt, "Select four contiguous spaces, finishing adjacent to Warangal" ], [ vm_shaded_6 ], [ vm_shaded_6_2 ], [ vm_return ], @@ -5455,13 +5472,34 @@ CODE[30 * 2 + 1] = [ // EVENT 31 CODE[31 * 2 + 0] = [ - [ vm_log, "NOT IMPLEMENTED" ], + [ vm_current, REBEL_FACTIONS ], + [ vm_prompt, "Free Migrate in a Province adjacent to Vijayanagara" ], + [ vm_space, true, 1, 1, (s)=>(is_adjacent_to_city(C_VIJAYANAGARA, s)) ], + [ vm_mark_space ], + [ vm_free_migrate ], + [ vm_clean_p ], + [ vm_prompt, "Remove an opposing Unit from the selected Province." ], + [ vm_piece, false, 1, 1, (p,s)=>(is_piece_in_event_space(p) && is_enemy_unit(p)) ], + [ vm_remove ], + [ vm_endpiece ], + [ vm_free_attack ], + [ vm_endspace ], [ vm_return ], ] // SHADED 31 CODE[31 * 2 + 1] = [ - [ vm_log, "NOT IMPLEMENTED" ], + [ vm_current, DS ], + [ vm_prompt, "Remove a Fort adjacent to Vijayanagara" ], + [ vm_piece, false, 1, 1, (p,s)=>(is_fort(p) && is_adjacent_to_city(C_VIJAYANAGARA, piece_space(p))) ], + [ vm_remove ], + [ vm_endpiece ], + [ vm_prompt, "Remove a Temple adjacent to Vijayanagara" ], + [ vm_piece, false, 1, 1, (p,s)=>(is_temple(p) && is_adjacent_to_city(C_VIJAYANAGARA, piece_space(p))) ], + [ vm_remove ], + [ vm_endpiece ], + [ vm_remove_influence, BK ], + [ vm_remove_influence, VE ], [ vm_return ], ] |