# Events for Vijayanagara EVENT 1 current REBEL_FACTIONS prompt "Move all Governors to Provinces adjacent to Delhi." piece all (is_governor(p) && !set_has(SPACES[S_DELHI].adjacent, piece_space(p))) space 1 (set_has(SPACES[S_DELHI].adjacent, s)) move endspace endpiece SHADED 1 current DS prompt "Select a Space to move in Units and Attack for free." space 1 s prompt `Move up to ${8-game.vm.pl.length} units in the selected space.` move_to (game.vm.s) (is_ds_unit(p) && is_piece_on_map(p) && !is_piece_in_event_space(p) && game.vm.pl.length < 8) to_rebel BK to_rebel VE log "" log `Opposing Units to Rebelling in ${SPACE_NAME[game.vm.s]}` free_attack endspace EVENT 2 prompt "Remove up to 2 Delhi Sultanate Units in both Mountain Passes and Punjab." space 2 ((s === S_MOUNTAIN_PASSES || s === S_PUNJAB) && has_ds_unit(s)) piece 2 is_ds_unit(p) && is_piece_in_event_space(p) remove endpiece endspace SHADED 2 current DS prompt "Attack for free in Mountain Passes or Punjab" space 1 ((s === S_MOUNTAIN_PASSES || s === S_PUNJAB) && has_ds_unit(s) && has_piece(s, MI, TROOPS)) free_attack endspace prompt "Choose a Space with which to rearrange Units with Mountain Passes and Punjab" space 1 (s !== S_MOUNTAIN_PASSES && s !== S_PUNJAB) mark_space endspace prompt `Move up to ${6-game.vm.pp.length} Units between the selected Spaces.` piece_opt 6 ([S_MOUNTAIN_PASSES, S_PUNJAB, game.vm.m[0]].includes(piece_space(p)) && is_ds_unit(p)) prompt `Move up to ${6-game.vm.pp.length+1} Units between the selected Spaces.` space 1 ((s === S_MOUNTAIN_PASSES || s === S_PUNJAB || s === game.vm.m[0]) && s !== piece_space(game.vm.p)) move endspace endpiece EVENT 3 current REBEL_FACTIONS prompt "Free Rally and gain 2 Resources in each Province adjacent to Warangal with your presence." space_opt all (is_adjacent_to_city(C_WARANGAL, s) && has_piece_faction(s, game.current)) free_rally resources (game.current) 2 endspace SHADED 3 current DS prompt "In each Province adjacent to Warangal with you presence, steal 2 Resources from each other Faction present." space_opt all (is_adjacent_to_city(C_WARANGAL, s) && has_piece_faction(s, DS) && has_piece_enemy_faction(s, DS)) if has_piece_faction(game.vm.s, BK) steal DS BK 2 endif if has_piece_faction(game.vm.s, VE) steal DS VE 2 endif endspace EVENT 4 current REBEL_FACTIONS prompt `Replace 1 Governor with an Obedient or Rebelling ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.` piece 1 is_governor(p) set_piece_space remove auto_place (game.current) ELITE event_4 endpiece SHADED 4 current DS prompt "Govern, without location requirements." govern EVENT 5 current REBEL_FACTIONS prompt `Replace up to 3 Delhi Sultanate Units with Rebelling ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.` piece_undo_opt 3 (is_adjacent_to_city(C_CHITTOR, piece_space(p)) && can_place_piece(piece_space(p), game.current, ELITE) && is_ds_unit(p)) set_piece_space remove auto_place_rebel (game.current) ELITE set_space -1 endpiece prompt `Place a ${PIECE_FACTION_TYPE_NAME[game.current][DISC]} in Rajput Kingdoms.` space_opt 1 (s === S_RAJPUT_KINGDOMS && can_place_piece(s, game.current, DISC)) auto_place (game.current) DISC endspace SHADED 5 current DS prompt "Replace up to 3 opposing Units adjacent to Chittor." piece_undo_opt 3 (is_adjacent_to_city(C_CHITTOR, piece_space(p)) && can_place_piece(piece_space(p), DS, TROOPS) && is_enemy_piece(p)) set_piece_space remove auto_place DS TROOPS set_space -1 endpiece prompt "Place a Qasbah in Rajput Kingdoms." space_opt 1 (s === S_RAJPUT_KINGDOMS && can_place_piece(s, DS, DISC)) auto_place DS DISC endspace EVENT 6 log "NOT IMPLEMENTED" SHADED 6 log "NOT IMPLEMENTED" EVENT 7 log "NOT IMPLEMENTED" SHADED 7 log "NOT IMPLEMENTED" EVENT 8 current REBEL_FACTIONS prompt `In each Province, replace a Delhi Sultanate Unit with a ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.` space_opt all (is_adjacent_to_city(C_DEVAGIRI, s) || is_adjacent_to_city(C_GULBARGA, s)) && has_ds_unit(s) && can_place_piece(s, game.current, ELITE) piece 1 is_ds_unit(p) && is_piece_in_event_space(p) remove auto_place (game.current) ELITE endpiece endspace SHADED 8 current DS prompt `In each Province, free Govern and then add a Troop.` space_opt all (is_adjacent_to_city(C_DEVAGIRI, s) || is_adjacent_to_city(C_GULBARGA, s)) && can_govern_in_space(s) free_govern place_opt 1 DS TROOPS endspace EVENT 9 current VE prompt "Compel in a Province adjacent to Warangal that you do not control and then Build there." add_influence VE space 1 (is_adjacent_to_city(C_WARANGAL, s) && !is_faction_control(s, game.current)) free_compel mark_space endspace prompt `Build in the same Province.` space_opt 1 (s === game.vm.m[0] && can_place_piece(s, game.current, DISC)) free_build endspace SHADED 9 current DS resources (game.current) 3 prompt "Add up to 4 Troops and 1 Governor in one Province adjacent to Warangal." space 1 is_adjacent_to_city(C_WARANGAL, s) place_opt 4 DS TROOPS place_opt 1 DS ELITE endspace EVENT 10 prompt "Move up to 4 Delhi Sultanate Units into adjacent Provinces." piece_undo_opt 4 is_ds_unit(p) prompt "Move Delhi Sultanate Unit into an adjacent space." space_no_undo 1 is_adjacent(s, piece_space(game.vm.p)) move endspace endpiece resources DS -5 SHADED 10 current DS prompt "Move any Qasbah to Spaces containing Governors." piece_opt all is_qasbah(p) space 1 has_governor(s) && !has_qasbah(s) move endspace endpiece prompt "Add up to 2 Troops in each Space with a Qasbah." space_opt all has_qasbah(s) place_opt 2 DS TROOPS endspace EVENT 11 prompt "Place up to two Mongol Invaders in each of Mtn Passes and Punjab." space_opt 2 (s === S_PUNJAB || s === S_MOUNTAIN_PASSES) place_opt 2 MI TROOPS endspace SHADED 11 current DS prompt "Remove 4 Mongol Invaders." piece 4 is_mongol_invader(p) remove endpiece EVENT 12 log "NOT IMPLEMENTED" SHADED 12 log "NOT IMPLEMENTED" EVENT 13 log "NOT IMPLEMENTED" SHADED 13 log "NOT IMPLEMENTED" EVENT 14 current VE gain_cavalry 2 asm game.vm.count = 0 repeat 2 prompt `Place up to ${2-game.vm.count} Rajas adjacent to Vijayanagara.` space_opt 1 is_adjacent_to_city(C_VIJAYANAGARA, s) && can_place_piece(s, VE, ELITE) auto_place VE ELITE asm (game.vm.count += 1) endspace endrepeat prompt "Remove a Tributary marker in a Province adjacent to Vijayanagara." space_opt 1 is_adjacent_to_city(C_VIJAYANAGARA, s) && is_tributary(s) remove_tributary endspace SHADED 14 current DS gain_cavalry 3 prompt "Place up to 4 Troops and 1 Governor in a province adjacent to Vijayanagara and Demand Obedience there." space_opt 1 is_adjacent_to_city(C_VIJAYANAGARA, s) place_opt 4 DS TROOPS place_opt 1 DS ELITE demand_obedience endspace EVENT 15 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 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 current BK asm game.vm.count = 0 repeat 3 prompt `Place up to ${3-game.vm.count} Amirs adjacent to Gulbarga.` space_opt 1 is_adjacent_to_city(C_GULBARGA, s) && can_place_piece(s, BK, ELITE) auto_place BK ELITE asm (game.vm.count += 1) endspace endrepeat prompt "Place a Fort adjacent to Gulbarga." space 1 is_adjacent_to_city(C_GULBARGA, s) && can_place_piece(s, BK, DISC) auto_place BK DISC endspace SHADED 16 current [DS VE] if game.current === DS prompt "Free March into a Province with a Fort, then remove the Fort." space_opt 1 has_piece(s, BK, DISC) && can_march_in_space(s) free_march asm game.vm.p = find_piece(game.vm.s, BK, DISC) remove endspace else prompt "Free Migrate into a Province with a Fort, then remove the Fort." space_opt 1 has_piece(s, BK, DISC) && can_migrate_in_space(s) free_migrate asm game.vm.p = find_piece(game.vm.s, BK, DISC) remove endspace endif EVENT 17 current BK add_influence BK prompt "Remove up to 5 Delhi Sultanate Units from Provinces with you presence." piece_opt 5 is_ds_unit(p) && has_piece_faction(piece_space(p), BK) remove endpiece SHADED 17 prompt "Remove a Fort and up to 2 Amirs from one Province." space_opt 1 has_piece_faction(s, BK) prompt "Remove 1 Fort from selected Province." piece_opt 1 is_piece_in_event_space(p) && is_fort(p) remove endpiece prompt "Remove up to 2 Amirs from selected Province." piece_opt 2 is_piece_in_event_space(p) && is_amir(p) remove endpiece endspace resources BK -2 EVENT 18 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 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 prompt `Place up to 2 ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]} in Jaunpur and Bengal.` space_opt all (s === S_BENGAL || s === S_JAUNPUR) && can_place_piece(s, game.current, ELITE) place_opt 2 (game.current) ELITE endspace prompt "Remove a Tributary marker in Jaunpur or Bengal." space_opt 1 (s === S_BENGAL || s === S_JAUNPUR) && is_tributary(s) remove_tributary endspace SHADED 19 current DS prompt `Place up to 4 ${PIECE_FACTION_TYPE_NAME[game.current][TROOPS]} in Jaunpur and Bengal.` space_opt all (s === S_BENGAL || s === S_JAUNPUR) && can_place_piece(s, game.current, TROOPS) place_opt 4 (game.current) TROOPS endspace prompt "Place a Tributary marker in Jaunpur or Bengal." space_opt 1 (s === S_BENGAL || s === S_JAUNPUR) && !is_tributary(s) place_tributary endspace EVENT 20 current REBEL_FACTIONS add_influence (game.current) prompt "In Orissa or an adjacent Province, you may Migrate, Rally and then Build." space 1 (is_adjacent_to_city(C_WARANGAL, s) || s === S_BENGAL) free_migrate free_rally free_build endspace SHADED 20 current DS prompt "In Orissa, remove an enemy Structure, add 1 Governor, 1 Qasbah, 2 Troops and a Tributary marker." space 1 (s === S_ORISSA) piece_opt 1 ((is_temple(p) || is_fort(p)) && is_piece_in_event_space(p)) remove endpiece place 1 DS ELITE place 1 DS DISC place 2 DS TROOPS place_tributary endspace EVENT 21 current REBEL_FACTIONS prompt "Move any Troops from Gondwana and Madhyadesh to Delhi." move_to S_DELHI (is_troop(p) && (piece_space(p) === S_GONDWANA || piece_space(p) === S_MADHYADESH)) SHADED 21 log "NOT IMPLEMENTED" EVENT 22 current REBEL_FACTIONS prompt `Build in any province with a ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.` space 1 can_build_in_space(s) free_build endspace SHADED 22 current DS prompt "Place 1 Troops in one space." space_opt 1 can_place_piece(s, DS, TROOPS) place_opt 1 DS TROOPS endspace prompt "Place 2 Troops in one space." space_opt 1 can_place_piece(s, DS, TROOPS) place_opt 2 DS TROOPS endspace prompt "Place 4 Troops in one space." space_opt 1 can_place_piece(s, DS, TROOPS) place_opt 4 DS TROOPS endspace EVENT 23 current VE prompt "Build and then replace a Unit with a Raja in each Province with a Temple." add_influence VE space 1 can_build_in_space(s) free_build endspace prompt "In each Province with a Temple, replace a Unit with a Raja." space all has_temple(s) && has_units_enemy_faction(s) piece 1 is_enemy_unit(p) && is_piece_in_event_space(p) remove auto_place VE ELITE endpiece endspace SHADED 23 prompt "Place 4 Units in a Province with a Temple." space_opt 1 has_temple(s) place_opt 4 (game.current) UNITS prompt "Remove the Temple." piece 1 (is_temple(p) && is_piece_in_event_space(p)) remove endpiece endspace steal (game.current) VE 2 EVENT 24 current VE prompt "Free Migrate in up to 2 Provinces." space_opt 2 can_migrate_in_space(s) free_migrate mark_space endspace prompt "Replace a Unit with a Raja." clean_p piece_opt 1 (can_place_piece(0, VE, ELITE) && set_has(game.vm.m, piece_space(p)) && is_enemy_unit(p)) set_piece_space remove auto_place (game.current) ELITE set_space -1 endpiece SHADED 24 current [DS BK] prompt "Place up to 2 Units in each Province with a Temple." space_opt all has_temple(s) place_opt 2 (game.current) UNITS endspace EVENT 25 current REBEL_FACTIONS event_25 SHADED 25 current DS prompt "Place up to 2 Troops in 3 Provinces adjance to Goa or Warangal." space_opt 3 (is_adjacent_to_city(C_GOA, s) || is_adjacent_to_city(C_WARANGAL, s)) mark_space place_opt 2 DS TROOPS endspace prompt "Govern in one of the selected Province." space 1 (can_govern_in_space(s) && set_has(game.vm.m, s)) free_govern endspace EVENT 26 log "NOT IMPLEMENTED" EVENT 27 current BK add_influence BK prompt "Place up to 2 Amirs in Sindh and Gujarat." space_opt all (s === S_GUJARAT || s === S_SINDH) && can_place_piece(s, game.current, ELITE) place_opt 2 BK ELITE endspace prompt "Place a Fort and remove a Tributary marker in Sindh." space 1 (s === S_SINDH) place 1 BK DISC remove_tributary endspace SHADED 27 current DS prompt "Place up to 2 Troops and a Governor in Sindh and Gujarat." space_opt all (s === S_GUJARAT || s === S_SINDH) && (can_place_piece(s, game.current, ELITE) || can_place_piece(s, game.current, TROOPS)) place_opt 2 DS TROOPS place_opt 1 DS ELITE endspace prompt "Place a Qasbah and a Tributary marker in Sindh." space 1 (s === S_SINDH) place 1 DS DISC place_tributary endspace EVENT 28 log "NOT IMPLEMENTED" SHADED 28 log "NOT IMPLEMENTED" EVENT 29 log "NOT IMPLEMENTED" SHADED 29 log "NOT IMPLEMENTED" EVENT 30 log "NOT IMPLEMENTED" SHADED 30 log "NOT IMPLEMENTED" EVENT 31 log "NOT IMPLEMENTED" SHADED 31 log "NOT IMPLEMENTED" EVENT 32 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 remove_influence BK remove_influence VE EVENT 33 current (has_majority_goa()) prompt "Remove up to 3 Opposing Units adjacent to Goa." piece_opt 3 (is_adjacent_to_city(C_GOA, piece_space(p)) && is_enemy_piece(p)) remove endpiece resources (game.current) 2 SHADED 33 current DS prompt "Reduce Rebel Factions Resources by half." resources_opt BK (-Math.floor(game.resources[BK]/2)) resources_opt VE (-Math.floor(game.resources[VE]/2)) EVENT 34 log "NOT IMPLEMENTED" SHADED 34 log "NOT IMPLEMENTED" EVENT 35 current REBEL_FACTIONS add_influence (game.current) prompt `Place a ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]} in up to 3 Provinces with ${PIECE_FACTION_TYPE_NAME[other_rebel_faction(game.current)][ELITE]}.` space_opt 3 has_piece(s, other_rebel_faction(game.current), ELITE) && can_place_piece(s, game.current, ELITE) auto_place (game.current) ELITE endspace SHADED 35 remove_influence BK remove_influence VE EVENT 36 current VE asm game.vm.count = 0 repeat 4 prompt `Place up to ${4-game.vm.count} Rajas adjacent to Chittor.` space_opt 1 is_adjacent_to_city(C_CHITTOR, s) && can_place_piece(s, VE, ELITE) auto_place VE ELITE asm (game.vm.count += 1) endspace endrepeat SHADED 36 remove_influence VE prompt "Remove up to 3 Rajas from the map." piece_opt 3 is_raja(p) && is_piece_on_map(p) remove endpiece