From 017f65de5983634ef03e653d3da4b93418ca5921 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 16 Feb 2020 15:45:54 +0100 Subject: [PATCH] Add easy to use macros for custom multi battles --- asm/macros/battle_frontier/battle_tower.inc | 74 +++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/asm/macros/battle_frontier/battle_tower.inc b/asm/macros/battle_frontier/battle_tower.inc index 71e795b1d..f399a5c9c 100644 --- a/asm/macros/battle_frontier/battle_tower.inc +++ b/asm/macros/battle_frontier/battle_tower.inc @@ -89,3 +89,77 @@ setvar VAR_0x8004, BATTLE_TOWER_FUNC_SET_INTERVIEW_DATA special CallBattleTowerFunc .endm + + @Custom multi-battle commands + + .macro choose_mons + fadescreen 1 + special ChooseHalfPartyForBattle @ choose 3 mons for battle + waitstate + .endm + + .macro multi_do type:req, partnerId:req, partnerPicId:req + special ReducePlayerPartyToSelectedMons + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SET_DATA + setvar VAR_0x8005, FRONTIER_DATA_SELECTED_MON_ORDER + special CallFrontierUtilFunc @ saves the mon order, so the non-selected mons get restored afterwards + setvar VAR_0x8004, SPECIAL_BATTLE_MULTI + setvar VAR_0x8005, \type | MULTI_BATTLE_CHOOSE_MONS + setvar VAR_0x8006, \partnerId + setvar VAR_0x8007, \partnerPicId + special DoSpecialTrainerBattle + waitstate + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SAVE_PARTY + special CallFrontierUtilFunc + special LoadPlayerParty + .endm + + .macro multi_2_vs_2 trainer1Id:req, trainer1LoseText:req, trainer2Id:req, trainer2LoseText:req, partnerId:req, partnerPicId:req + special SavePlayerParty + trainerbattle TRAINER_BATTLE_SET_TRAINER_A, \trainer1Id, 0, NULL, \trainer1LoseText @ set first trainer mons + trainerbattle TRAINER_BATTLE_SET_TRAINER_B, \trainer2Id, 0, NULL, \trainer2LoseText @ set second trainer mons + multi_do MULTI_BATTLE_2_VS_2, \partnerId, \partnerPicId + .endm + + .macro multi_2_vs_1 trainer1Id:req, trainer1LoseText:req, partnerId:req, partnerPicId:req + special SavePlayerParty + trainerbattle TRAINER_BATTLE_SET_TRAINER_A, \trainer1Id, 0, NULL, \trainer1LoseText @ set first trainer mons + multi_do MULTI_BATTLE_2_VS_1, \partnerId, \partnerPicId + .endm + + @ Wild mons need to be assigned to gEnemyParty 0 and 3 slots, other slots need to be cleared out. + .macro multi_wild partnerId:req, partnerPicId:req + special SavePlayerParty + multi_do MULTI_BATTLE_2_VS_WILD, \partnerId, \partnerPicId + .endm + + .macro multi_do_fixed type:req, partnerId:req, partnerPicId:req + setvar VAR_0x8004, SPECIAL_BATTLE_MULTI + setvar VAR_0x8005, \type + setvar VAR_0x8006, \partnerId + setvar VAR_0x8007, \partnerPicId + special DoSpecialTrainerBattle + waitstate + setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SAVE_PARTY + special CallFrontierUtilFunc + special LoadPlayerParty + .endm + + .macro multi_fixed_2_vs_2 trainer1Id:req, trainer1LoseText:req, trainer2Id:req, trainer2LoseText:req, partnerId:req, partnerPicId:req + special SavePlayerParty + trainerbattle TRAINER_BATTLE_SET_TRAINER_A, \trainer1Id, 0, NULL, \trainer1LoseText @ set first trainer mons + trainerbattle TRAINER_BATTLE_SET_TRAINER_B, \trainer2Id, 0, NULL, \trainer2LoseText @ set second trainer mons + multi_do_fixed MULTI_BATTLE_2_VS_2, \partnerId, \partnerPicId + .endm + + .macro multi_fixed_2_vs_1 trainer1Id:req, trainer1LoseText:req, partnerId:req, partnerPicId:req + special SavePlayerParty + trainerbattle TRAINER_BATTLE_SET_TRAINER_A, \trainer1Id, 0, NULL, \trainer1LoseText @ set first trainer mons + multi_do_fixed MULTI_BATTLE_2_VS_1, \partnerId, \partnerPicId + .endm + + @ Wild mons need to be assigned to gEnemyParty 0 and 3 slots, other slots need to be cleared out. + .macro multi_fixed_wild partnerId:req, partnerPicId:req + special SavePlayerParty + multi_do_fixed MULTI_BATTLE_2_VS_WILD, \partnerId, \partnerPicId + .endm